Repeating a repeat-loop several times in one frame of the mainloop

hi there

as a little exercise i tried to patch a basic ear clipping algo that is able to triangulate a simple polygon.
the algorythm interates through a list of 2d points, check each of them if it meets the condition and if the first one in the list meets the condition this point will be deleted in the list, and the loop restarts with the remaining points, until no points are remaining anymore.

the problem i have now, is that each time the loop restarts, this will be done in a new frame within the mainloop. i want this all be done within one frame. no idea how to achieve this. please see the attatched patch (i slowed down the mainloops to make visible what happens)

ele
EarClipper7.vl (160.0 KB)

Removed some stuff, hope I didn’t break it.

edit: I broke it :)

edit2: I think I fixed it

EarClipper8.vl (155.0 KB) it.

thx bjoern, but i think theres a problem with that simplified aproach. i think its because the repeat loop index doesnt return the zero once it found a result but continues from its current index. in certain cases that can lead to wrong triangulation. i put my method with the break and yours next to each other to compare…
maybe the solution would be something like that each time it founds a result the index gets stored and substracted from itself in the next iteration of the loop… not sure.

EarClipper9.vl (200.9 KB)

Had another go. The results are still different sometimes but I don’t think they are wrong.

EarClipper10.vl (202.1 KB)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.