Re: Line intersection point is wrong - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Line intersection point is wrong
Date
Msg-id 18081.1466367402@sss.pgh.pa.us
Whole thread Raw
In response to Re: Line intersection point is wrong  (Emre Hasegeli <emre@hasegeli.com>)
Responses Re: Line intersection point is wrong  (Emre Hasegeli <emre@hasegeli.com>)
List pgsql-bugs
Emre Hasegeli <emre@hasegeli.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

pgsql-bugs by date:

Previous
From: Emre Hasegeli
Date:
Subject: Re: Line intersection point is wrong
Next
From: Emre Hasegeli
Date:
Subject: Re: Line intersection point is wrong