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

insertEdge can get stuck in an infinite loop #113

Closed proc-sim closed 1 year ago

proc-sim commented 2 years ago

Last one for today....

In some situations (rare) insertEdge can get stuck in a loop where a small number of edges will shuffle in and out of the 'remaining' vector repeatedly, so that it never empties. Not exactly sure why.

Attached is the vert/edge data in the same format as the data in the other issue I posted. Only difference is that here I construct the CDT as follows:

CDT::Triangulation<double> cdt(CDT::VertexInsertionOrder::AsProvided);

cdtDebugEdges.txt cdtDebugVerts.txt

In this particular case, the content of 'remaining' eventually cycles between edge {243, 244} and edge {224, 244}, forever.

artem-ogre commented 1 year ago

Thanks for opening the issue again, @tysoni. Same as with #111 the input has duplicates. After removing them CDT produces a triangulation:

duplicates = 
 [0] = 223
 [1] = 224
 [2] = 225
 [3] = 226
 [4] = 227
 [5] = 228
 [6] = 229
 [7] = 230
 [8] = 231
 [9] = 232
 [10] = 233
 [11] = 234
 [12] = 235
 [13] = 236
 [14] = 237
 [15] = 238
 [16] = 239
 [17] = 240
 [18] = 241
 [19] = 259
 [20] = 260
 [21] = 261
 [22] = 265
 [23] = 266
 [24] = 267

cdt_screenshot

artem-ogre commented 1 year ago

I'm closing this, please let me know if you think this should be re-open.