miho / JCSG

Java implementation of BSP based CSG (Constructive Solid Geometry)
Other
178 stars 54 forks source link

Plane splitPolygon running into loop / StackOverflowError #53

Open udatny opened 5 years ago

udatny commented 5 years ago

i runned several times into the stackoverflow issue (which also people reported https://github.com/miho/JCSG/issues/48 ) and i am still not sure what it is causing. fact is, that under certain circumstances the Plane.splitPolygon could end in a loop. somehow it does not recognize polygons as coplanar.

it is reproducable with the AppleTest i added. (simply run mvn test -Dtest=eu.mihosoft.jcsg.AppleTest in the root folder)

a possible fix is also there but in my opinion it is not addressing the root cause....it just works around the issue.

maybe you find time to analyze.

jimbok8 commented 5 years ago

I have a StackOverflowError when performing the intersect method on two objects. I have tried your code and it does get rid of the StackOverflowError on the intersect method, however it does not produce the correct output for the difference method.

In addition, it produces many lines of "our plane is not spanning and not coplannar but it should be 1.0"

Any ideas? PS Thanks for the work to get rid of the stackoverflow!

madhephaestus commented 3 years ago

I think you may be working around the issue i fixed in #64 @jimbok8 Give it a shot?