Re: line_perp() (?-|) is broken. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: line_perp() (?-|) is broken.
Date
Msg-id 13821.1520037585@sss.pgh.pa.us
Whole thread Raw
In response to line_perp() (?-|) is broken.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: line_perp() (?-|) is broken.  (Emre Hasegeli <emre@hasegeli.com>)
List pgsql-hackers
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> I happend to see a strange geometric calcualtion on master/HEAD.
> ...
> Instead, calculating inner product of the two direction vectors
> works as expected.
>   (l1->A * l2->A) + (l1->B * l2->B) == 0

This seems to be a strict subset of the changes in Emre Hasgeli's
latest geometric-types patch.  I'm disinclined to commit it unless
that patch gets rejected, as it'll just require Emre to rebase again.

However, for either patch, I'm a bit concerned about using FPzero()
on the inner product result.  To the extent that the EPSILON bound
has any useful meaning at all, it needs to mean a maximum difference
between two coordinate values.  The inner product has units of coordinates
squared, so it seems like EPSILON isn't an appropriate threshold there.

Possibly this objection is pointless, because I'm not at all sure that
the existing code is careful about how it uses FPeq/FPzero; perhaps
we're applying EPSILON to all manner of numbers that don't have units
of the coordinate space.  But this won't help make it better.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: JIT compiling with LLVM v11
Next
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Add much-more-extensive TAP tests forpgbench.