Re: Line intersection point is wrong

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: emre(at)hasegeli(dot)com
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Line intersection point is wrong
Date: 2016-06-19 20:16:42
Message-ID: 18081.1466367402@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Emre Hasegeli <emre(at)hasegeli(dot)com> writes:
>> Hmm, well, what if we change line_parallel() so that what it tests
>> is whether (l1->A * l2->B - l2->A * l1->B) is zero? That seems
>> simpler and more symmetric than what it does now.

> I was thinking to do so. I would also check for both sides not to
> overflow, but that can wait. Patch attached. Unfortunately,
> the change causes too much noise on the regression tests.

I don't think this is right:

+ x = (l1->B * l2->C - l2->B * l1->C) / (l1->A * l2->B - l2->A * l1->B);
+ y = (l1->A * x + l1->C) / l1->B;

You haven't done anything to exclude the possibility that l1->B is zero,
so you could be getting zero-divide in the y calculation.

FWIW, given that you're claiming the calculation is wrong as-is, there
is no particularly good reason to assume that the expected results
embedded in select_views.out are correct :-(. I doubt anyone's ever
tried to verify those independently.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Emre Hasegeli 2016-06-19 20:30:08 Re: Line intersection point is wrong
Previous Message Emre Hasegeli 2016-06-19 19:19:54 Re: Line intersection point is wrong