Skip to content

Commit cbf68a1

Browse files
committed
add ignore code to separation
1 parent aea366f commit cbf68a1

File tree

1 file changed

+4
-0
lines changed
  • processing-mode/example3/java/src/main/java/test

1 file changed

+4
-0
lines changed

processing-mode/example3/java/src/main/java/test/Boid.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ protected PVector separate(ArrayList<Boid> boids) {
136136
int count = 0;
137137
// For every boid in the system, check if it's too close
138138
for (Boid other : boids) {
139+
// ignore boids in other clusters
140+
if (other.clusterLabel != clusterLabel) {
141+
continue;
142+
}
139143
float d = PVector.dist(position, other.position);
140144
// If the distance is greater than 0 and less than an arbitrary amount (0 when
141145
// you are yourself)

0 commit comments

Comments
 (0)