The add_node function now wraps around instead of spawning nodes out of bounds

This commit is contained in:
Emi Simpson 2021-11-17 18:50:36 -05:00
parent 115df64386
commit a745c63de9
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 3 additions and 0 deletions

View File

@ -647,6 +647,9 @@ impl DelaunayDemo {
let offset = direction / direction.length() * BOING_RADIUS;
node.0 += offset;
node.0.x = node.0.x.rem_euclid(self.width);
node.0.y = node.0.y.rem_euclid(self.width);
cycle_completed = false;
break;
}