grimsa / polysplit

An implementation of polygon splitting algorithm (unfinished)
MIT License
10 stars 6 forks source link

Verify discarding of edge pairs when their subpolygons fall partly outside of the polygon #6

Open grimsa opened 8 years ago

grimsa commented 8 years ago

Currently edge pairs are discarded from the calculation, when any part of triangle1, trapezoid or triangle2 (within which a cut could be located) falls outside the actual polygon being split.

However some cuts might be valid and should be considered, as long as the area outside of the polygon is not included in the calculation.

grimsa commented 8 years ago

The issue is valid.

One of the triangles of edge pair (AB & EF) - B'BE falls partly outside of the polygon ABCDEF...... (part outside marked in red). In this case areaAdjacentToTriangle (e.g. 200, marked in grey) could be reduced by the amount marked in red (say, 50) and calculation could proceed. Note that in this case areaAdjacentToTriangle can sometimes be negative (when red area is larger than grey one) and that would be a valid case.

polygon