Caught a literal edge case: for some reason, after resizing an image, the doPhysics() function started locking up on a warning that points along the edge of the image were not held within triangles. Added a try-catch and continue statement to force the process through without failing on those particular points.

This commit is contained in:
mattmcw 2021-03-27 07:18:32 -04:00
parent 69110f615f
commit 1d3b6ac53e
1 changed files with 5 additions and 3 deletions

View File

@ -866,9 +866,11 @@ void doPhysics() {
for (int i = vorPointsAdded; i < temp; i++) {
// Optional, for diagnostics:::
// println("particles[i].x, particles[i].y " + particles[i].x + ", " + particles[i].y );
voronoi.addPoint(new Vec2D(particles[i].x, particles[i].y ));
try {
voronoi.addPoint(new Vec2D(particles[i].x, particles[i].y ));
} catch (Exception e) {
continue;
}
vorPointsAdded++;
}