/** * 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(); }
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; }
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; }