@Test public void testEmptySet() { NicGeoPoint dstPoint = interpolator.interpolatePosition(distanceSet); assertEquals(0.0, dstPoint.getX()); assertEquals(0.0, dstPoint.getY()); }
@Override public T interpolatePosition(final SortedSet<T> points) { if (points.size() == 0) { return pointFactory.newPoint(); } float normalizationFactor = 0; float x = 0; float y = 0; for (final T point : points) { if (point.getDivergence() == 0.0) { return point; } final double weight = 1 / point.getDivergence(); normalizationFactor += weight; x += weight * point.getX(); y += weight * point.getY(); } x = x / normalizationFactor; y = y / normalizationFactor; return getResultingPoint(x, y); }
ReciprocalInterpolation implements PositionInterpolator<T> { @Override public T interpolatePosition(final SortedSet<T> points) { if (points.size() == 0) { return pointFactory.newPoint(); } float normalizationFactor = 0; float x = 0; float y = 0; for (final T point : points) { if (point.getDivergence() == 0.0) { return point; } final double weight = 1 / point.getDivergence(); normalizationFactor += weight; x += weight * point.getX(); y += weight * point.getY(); } x = x / normalizationFactor; y = y / normalizationFactor; return getResultingPoint(x, y); } }
ReciprocalInterpolation implements PositionInterpolator<T> { @Override public T interpolatePosition(final SortedSet<T> points) { if (points.size() == 0) { return pointFactory.newPoint(); } float normalizationFactor = 0; float x = 0; float y = 0; for (final T point : points) { if (point.getDivergence() == 0.0) { return point; } final double weight = 1 / point.getDivergence(); normalizationFactor += weight; x += weight * point.getX(); y += weight * point.getY(); } x = x / normalizationFactor; y = y / normalizationFactor; return getResultingPoint(x, y); } ReciprocalInterpolation(final PointFactory<T> factory); }
ReciprocalInterpolation implements PositionInterpolator<T> { @Override public T interpolatePosition(final SortedSet<T> points) { if (points.size() == 0) { return pointFactory.newPoint(); } float normalizationFactor = 0; float x = 0; float y = 0; for (final T point : points) { if (point.getDivergence() == 0.0) { return point; } final double weight = 1 / point.getDivergence(); normalizationFactor += weight; x += weight * point.getX(); y += weight * point.getY(); } x = x / normalizationFactor; y = y / normalizationFactor; return getResultingPoint(x, y); } ReciprocalInterpolation(final PointFactory<T> factory); @Override T interpolatePosition(final SortedSet<T> points); }
ReciprocalInterpolation implements PositionInterpolator<T> { @Override public T interpolatePosition(final SortedSet<T> points) { if (points.size() == 0) { return pointFactory.newPoint(); } float normalizationFactor = 0; float x = 0; float y = 0; for (final T point : points) { if (point.getDivergence() == 0.0) { return point; } final double weight = 1 / point.getDivergence(); normalizationFactor += weight; x += weight * point.getX(); y += weight * point.getY(); } x = x / normalizationFactor; y = y / normalizationFactor; return getResultingPoint(x, y); } ReciprocalInterpolation(final PointFactory<T> factory); @Override T interpolatePosition(final SortedSet<T> points);  }