You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using your code for my thesis project, and came across an edge case where triangulating the mesh for composite shape with holes fails. It happens when the very first hull point meets all the criteria to be the intersection for the hole's bridge point.
Code Error + Possible Fix
Here's the code that keeps failing (Triangulator.cs, line 161):
When you are on the first run through the while (currentNode != null) loop, and potentialNewBridgeNode gets set to p0, there is no .Previous so it aborts with a null reference exception.
Based on my understanding of what's going on in the code, I changed it to this, and now everything seems to be working.
The image below outlines a simple example that replicates the error. I want to create a composite shape that is rectangular, with a rectangular hole cut out of it. I have the following points, shown as vertices on the left and plotted on the graph in the center. The blue points represent the first shape in my shapeList, and the orange/red represents the second shape. I call (new CompositeShape(shapeList)).getMesh(). The red point marks the bridge point that connects the hole to the rest of the hull. Finally, GenerateVertices() gets called with the Polygon object on the right.
Hopefully this helps you figure out exactly what's going on. My fix seems to work fine for my use case, but I'm not 100% that it doesn't break under other circumstances.
Anyway, thanks for providing this code, along with a video tutorial! It's been super helpful.
The text was updated successfully, but these errors were encountered:
Hello!
I've been using your code for my thesis project, and came across an edge case where triangulating the mesh for composite shape with holes fails. It happens when the very first hull point meets all the criteria to be the intersection for the hole's bridge point.
Code Error + Possible Fix
Here's the code that keeps failing (Triangulator.cs, line 161):
When you are on the first run through the
while (currentNode != null)
loop, andpotentialNewBridgeNode
gets set top0
, there is no.Previous
so it aborts with a null reference exception.Based on my understanding of what's going on in the code, I changed it to this, and now everything seems to be working.
Steps to Reproduce
The image below outlines a simple example that replicates the error. I want to create a composite shape that is rectangular, with a rectangular hole cut out of it. I have the following points, shown as vertices on the left and plotted on the graph in the center. The blue points represent the first shape in my

shapeList
, and the orange/red represents the second shape. I call(new CompositeShape(shapeList)).getMesh()
. The red point marks the bridge point that connects the hole to the rest of the hull. Finally,GenerateVertices()
gets called with thePolygon
object on the right.Hopefully this helps you figure out exactly what's going on. My fix seems to work fine for my use case, but I'm not 100% that it doesn't break under other circumstances.
Anyway, thanks for providing this code, along with a video tutorial! It's been super helpful.
The text was updated successfully, but these errors were encountered: