karl- / pb_CSG

A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/).
MIT License
634 stars 99 forks source link

50% of the time causes a stackoverflow exception when using standard subtract demo #35

Open fredborden214 opened 1 year ago

fredborden214 commented 1 year ago

StackOverflowException: The requested operation caused a stack overflow. System.Collections.Generic.List1[T].set_Capacity (System.Int32 value) (at <03bd9b261dff4c2b8b568aca27f561b2>:0) System.Collections.Generic.List1[T].EnsureCapacity (System.Int32 min) (at <03bd9b261dff4c2b8b568aca27f561b2>:0) System.Collections.Generic.List1[T].AddWithResize (T item) (at <03bd9b261dff4c2b8b568aca27f561b2>:0) Parabox.CSG.Plane.SplitPolygon (Parabox.CSG.Polygon polygon, System.Collections.Generic.List1[T] coplanarFront, System.Collections.Generic.List1[T] coplanarBack, System.Collections.Generic.List1[T] front, System.Collections.Generic.List1[T] back) (at Packages/co.parabox.csg/CSG/Classes/Plane.cs:108) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:108) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs:119) Parabox.CSG.Node.Build (System.Collections.Generic.List`1[T] list) (at Packages/co.parabox.csg/CSG/Classes/Node.cs

BrunoNext commented 1 year ago

I am having the same issue doing a Subtract operation on a complex mesh, every time.

Is their any workaround?

fredborden214 commented 1 year ago

made a fix that worked for me: https://github.com/fredborden214/pb_CSG

karl- commented 6 months ago

In many cases these problems can be reduced or eliminated by adjusting the epsilon values used.