@Test public void testCalculatePosition() { pf = new ParticleFilterTestable(); pf.setNumParticles(4); Particle tmp = new Particle(1.f, 2.f, 0.25f); pf.particleList.add(tmp); tmp = new Particle(3.f, 4.f, 0.01f); pf.particleList.add(tmp); tmp = new Particle(5.f, 6.f, 0.73f); pf.particleList.add(tmp); tmp = new Particle(7.f, 8.f, 0.01f); pf.particleList.add(tmp); NicGeoPoint pos = pf.calculatePosition(); assertEquals(4.f, pos.getX(), 0.2f); assertEquals(5.f, pos.getY(), 0.2f); }
public NicGeoPoint calculatePosition() { final NicGeoPoint currentPosition = new NicGeoPointImpl(); float meanX = 0.f; float meanY = 0.f; for (int i = 0; i < particleList.size(); i++) { meanX += particleList.get(i).getX(); meanY += particleList.get(i).getY(); } currentPosition.setXY(meanX/numParticles, meanY/numParticles); return currentPosition; }
ParticleFilter { public NicGeoPoint calculatePosition() { final NicGeoPoint currentPosition = new NicGeoPointImpl(); float meanX = 0.f; float meanY = 0.f; for (int i = 0; i < particleList.size(); i++) { meanX += particleList.get(i).getX(); meanY += particleList.get(i).getY(); } currentPosition.setXY(meanX/numParticles, meanY/numParticles); return currentPosition; } }
ParticleFilter { public NicGeoPoint calculatePosition() { final NicGeoPoint currentPosition = new NicGeoPointImpl(); float meanX = 0.f; float meanY = 0.f; for (int i = 0; i < particleList.size(); i++) { meanX += particleList.get(i).getX(); meanY += particleList.get(i).getY(); } currentPosition.setXY(meanX/numParticles, meanY/numParticles); return currentPosition; } ParticleFilter(final Context ctx, UserPositionManager userPositionManager); }
ParticleFilter { public NicGeoPoint calculatePosition() { final NicGeoPoint currentPosition = new NicGeoPointImpl(); float meanX = 0.f; float meanY = 0.f; for (int i = 0; i < particleList.size(); i++) { meanX += particleList.get(i).getX(); meanY += particleList.get(i).getY(); } currentPosition.setXY(meanX/numParticles, meanY/numParticles); return currentPosition; } ParticleFilter(final Context ctx, UserPositionManager userPositionManager); void initialize(double curX, double curY); void updateAction(double x, double y); void updateSensor(double x, double y); void resampling(); void clearParticles(); void setShowParticles(boolean enabled); void setNumParticles(int particles); void setScale(float scale); NicGeoPoint calculatePosition(); }
ParticleFilter { public NicGeoPoint calculatePosition() { final NicGeoPoint currentPosition = new NicGeoPointImpl(); float meanX = 0.f; float meanY = 0.f; for (int i = 0; i < particleList.size(); i++) { meanX += particleList.get(i).getX(); meanY += particleList.get(i).getY(); } currentPosition.setXY(meanX/numParticles, meanY/numParticles); return currentPosition; } ParticleFilter(final Context ctx, UserPositionManager userPositionManager); void initialize(double curX, double curY); void updateAction(double x, double y); void updateSensor(double x, double y); void resampling(); void clearParticles(); void setShowParticles(boolean enabled); void setNumParticles(int particles); void setScale(float scale); NicGeoPoint calculatePosition();  }