artem-ogre / CDT

Constrained Delaunay Triangulation (C++)
https://artem-ogre.github.io/CDT/
Mozilla Public License 2.0
1.08k stars 136 forks source link

result triangles somtimes cross each other #64

Closed zinuok closed 3 years ago

zinuok commented 3 years ago

Hello, I'm using following commands,

CDT::RemoveDuplicatesAndRemapEdges(vertices, edges); // remove duplicate
cdt.eraseSuperTriangle( ); // make mesh in the case the outer boundary edges don't exist

However, the result triangles sometimes cross over, making ill-shaped mesh But this does not always happen. (also, I found that this does not happen at all if only a point is used, but if a line is added, this case occurs quite a bit.) Are there any tips or methods to prevent this??

image

zinuok commented 3 years ago

After some debugging, I found the cause.

for some reason, I rounded the x,y coordinates of points and lines. The problem was caused by overlapping different lines with the same x and y. If no rounding is done, a triangle is created well.