fontanf / packingsolver

A solver for (geometrical) packing problems
MIT License
89 stars 14 forks source link

Polygon simplification error #74

Closed bbeaulant closed 2 months ago

bbeaulant commented 2 months ago

Hello Florian,

The following input shape throws a polygon_simplification error.

test_input.json

above yb 4.16869732 yt 4.20805402 xbl 12.21942451 xbr 13.30533793146222 xtl 12.21942451 xtr 13.32079485340323
below yb 4.08993824 yt 4.16869732 xbl 12.21942452 xbr 13.27440614724999 xtl 12.21942452 xtr 13.30533793146222
merge yb 4.08993824 yt 4.20805402 xbl 12.21942452 xbr 13.27440614724999 xtl 12.21942452 xtr 13.32079485340323
cost -3.93567e-10
c_old 0.12735
c_new 0.12735

Before simplification, it looks like that :

trapezoid_x_0_0 000000

I hope this can help you. Regards,

fontanf commented 2 months ago

Hi,

Thank you for reporting.

It seems to be a numerical issue. The multiplication from the area increase the error above the threshold. For now I don't see a clean way to fix this. I just disabled this check.

In 58c6a4719ff2b68ab4e8f6d55a77d9514f40eb16