robust-predicates
robust-predicates copied to clipboard
Undocumented: `orient2d` returns -0, not +0
For all the cases I tested, orient2d returns -0, not +0 as I would have assumed, since the readme doesn't specify a sign. Is this always the case? If not, under what circumstances would it not be?
One interesting (although possibly out-of-scope) idea for remedying this asymmetry for collinear points would be to return +0 if b is between a and c, and -0 otherwise (or vice versa). That would allow distinguishing between 0º and 180º angles, which might be kinda cool. (Like for example, one use-case for that could be checking the convexity of a polygon... you can make only same-sign turns and 0º turns, but not 180º turns). Effectively that would mean the half-open interval [0º, 180º) would be positive-signed and [180º, 360º) would be negative-signed, which seems a bit more symmetric & informative than the current behavior of the open interval (0º, 180º) positive-signed and closed interval [180º, 360º] negative-signed. Food for thought 😄