Regression when removing type casting in IsCollinear()
When updating to the latest revision of Clipper2, we encountered a regression due to #825 for removing the type casting in IsCollinear().
In this test case, we have four points that cross over in an hourglass shape. We call Execute(Union, EvenOdd) to "repair" this invalid polygon into a pair of triangles that touch at a point.
These values, which are intended for single-precision floats, work as intended:
Input (with AddSubject()):
-536870912, -536870912
536870912, -536870912
-536870912, 536870912
536870912, 536870912
Output (2 paths):
0, 0
-536870912, 536870912
536870912, 536870912
536870912, -536870912
-536870912, -536870912
0, 0
However, these values, which are intended for doubles, break with #825:
-1125899906842624, -1125899906842624
1125899906842624, -1125899906842624
-1125899906842624, 1125899906842624
1125899906842624, 1125899906842624
With the latest revision, the call to Execute() gives an empty result rather than two paths similar to the smaller integer values.
Aaron, thank you for your very clear and concise bug report. I'll check it out and hopefully have a fix soon (<24hrs).
Thanks. I should also clarify that I am using the C++ library.
Can reproduce. Yeah, with these inputs (which are exactly ±0x4000000000000) and using integer math, a*b wraps to 0, as does c*d. So perhaps an error in this direction is more critical than an error in the other direction after all (see the comment here).
This has been fixed in the latest repository revision.