mathutil: error instead of infinite loop if triangulation failed

Fixes #985
This commit is contained in:
rdb 2020-08-11 09:38:41 +02:00
parent 32143055bd
commit 9c4cb28805

View File

@ -150,7 +150,11 @@ triangulate() {
} }
*/ */
int attempts = 0;
while (construct_trapezoids(num_segments) != 0) { while (construct_trapezoids(num_segments) != 0) {
nassertv_always(attempts++ < 100);
// If there's an error, re-shuffle the index and try again. // If there's an error, re-shuffle the index and try again.
Randomizer randomizer; Randomizer randomizer;
for (i = 0; i < num_segments; ++i) { for (i = 0; i < num_segments; ++i) {