Beispiel #1
0
 protected Particle returnIfConstrained(int index) {
   Particle p = (Particle) particles.get(index);
   for (int i = 0; i < constraints.size(); i++) {
     Particle other = (Particle) constraints.get(i);
     if (p.equalsWithTolerance(other, .1f)) {
       return other;
     }
   }
   return p;
 }
Beispiel #2
0
 protected Particle returnIfDouble(Particle p) {
   for (int i = 0; i < particles.size(); i++) {
     Particle other = (Particle) particles.get(i);
     if (p.equals(other)) {
       return other;
     }
   }
   particles.add(p);
   return p;
 }
Beispiel #3
0
 protected Particle returnIfConstrained(Particle p) {
   if (this.constraints != null) {
     for (int i = 0; i < constraints.size(); i++) {
       Particle other = (Particle) constraints.get(i);
       if (p.equalsWithTolerance(other, .1f)) {
         return other;
       }
     }
   }
   Particle particle = returnIfDouble(p);
   return particle;
 }