AngusJohnson / Clipper2

Polygon Clipping and Offsetting - C++, C# and Delphi
Boost Software License 1.0
1.45k stars 266 forks source link

`IsCollinear`: detect and handle integer multiplication wrapping #832

Closed reunanen closed 4 months ago

reunanen commented 4 months ago

Resolves #831.

tomwiel commented 4 months ago

About safe multiplication: Starting with C23, C has ckd_mul(): if (ckd_mul(&res, a, b)) { res is wrapped result} else { res is correct result} Other languages would need the same.

reunanen commented 4 months ago

Closed this PR in favor of https://github.com/AngusJohnson/Clipper2/pull/834.