After analyzing the bug with our numerical tools, we believe the bug can be fixed by changing the code in DistanceFromLineSqrd() as follows: (about line 4339 of clipper.cpp) -- double C = A * ln1.X + B * ln1.Y; ++ double C = double(ln2.X) * ln1.Y - double(ln2.Y) * ln1.X; Although the fixed expression is mathematically equivalent to the original expression, they yield different outputs in floating-point values. When A == double(ln1.Y - ln2.Y) && B == double(ln2.X - ln1.X), the fixed expression get...
a Numerical bug in the function Area
Numerical Error when calling CleanPolygon