Beispiel #1
0
 /**
  * Gets the delta from dead reckoning and moves the distribution in this direction
  *
  * @param x delta x
  * @param y delta y
  */
 public void updateAction(double x, double y) {
   // propagate position through motion model
   for (Particle particle : particleList) {
     final double val = nextGaussian() * sigmaAction * scale;
     particle.setXY(particle.getX() + x + val, particle.getY() + y + val);
   }
   showParticles();
 }
Beispiel #2
0
  public double getAccelerationY(Particle p) {

    if ((p.getRecX() >= this.x) && (p.getRecX() <= (this.x + this.length)) && this.haveDone) {
      p.setRecY(2 * p.getY() - p.getRecY());
      this.haveDone = false;
    }

    return 0;
  }
Beispiel #3
0
  public boolean collidesWith(Particle p) {
    float deltaX = this.getX() - p.getX();
    float deltaY = this.getY() - p.getY();
    float minDist = this.getR() + p.getR();
    float distance = deltaX * deltaX + deltaY * deltaY;

    if (distance <= (minDist * minDist)) {
      return true;
    }

    return false;
  }