@Test public void testGetPercentLatLonNegativePercent() { Path path = createPath(0d, -90d, 0d, 90d, 180d, 90d); double percent = -0.25; LatLon expected = new LatLon(Angle.ZERO, Angle.NEG90); LatLon result = path.getPercentLatLon(percent); assertLatLonsEqual(expected, result); }
public synchronized LatLon getPercentLatLon(double percent) { if (percent <= 0) { return positions.firstEntry().getValue(); } if (percent >= 1) { return positions.lastEntry().getValue(); } if (positions.containsKey(percent)) { return positions.get(percent); } Entry<Double, LatLon> lower = positions.lowerEntry(percent); Entry<Double, LatLon> higher = positions.higherEntry(percent); double p = (percent - lower.getKey()) / (higher.getKey() - lower.getKey()); return LatLon.interpolateGreatCircle(p, lower.getValue(), higher.getValue()); }
Path { public synchronized LatLon getPercentLatLon(double percent) { if (percent <= 0) { return positions.firstEntry().getValue(); } if (percent >= 1) { return positions.lastEntry().getValue(); } if (positions.containsKey(percent)) { return positions.get(percent); } Entry<Double, LatLon> lower = positions.lowerEntry(percent); Entry<Double, LatLon> higher = positions.higherEntry(percent); double p = (percent - lower.getKey()) / (higher.getKey() - lower.getKey()); return LatLon.interpolateGreatCircle(p, lower.getValue(), higher.getValue()); } }
Path { public synchronized LatLon getPercentLatLon(double percent) { if (percent <= 0) { return positions.firstEntry().getValue(); } if (percent >= 1) { return positions.lastEntry().getValue(); } if (positions.containsKey(percent)) { return positions.get(percent); } Entry<Double, LatLon> lower = positions.lowerEntry(percent); Entry<Double, LatLon> higher = positions.higherEntry(percent); double p = (percent - lower.getKey()) / (higher.getKey() - lower.getKey()); return LatLon.interpolateGreatCircle(p, lower.getValue(), higher.getValue()); } Path(List<LatLon> positions); }
Path { public synchronized LatLon getPercentLatLon(double percent) { if (percent <= 0) { return positions.firstEntry().getValue(); } if (percent >= 1) { return positions.lastEntry().getValue(); } if (positions.containsKey(percent)) { return positions.get(percent); } Entry<Double, LatLon> lower = positions.lowerEntry(percent); Entry<Double, LatLon> higher = positions.higherEntry(percent); double p = (percent - lower.getKey()) / (higher.getKey() - lower.getKey()); return LatLon.interpolateGreatCircle(p, lower.getValue(), higher.getValue()); } Path(List<LatLon> positions); synchronized Angle getLength(); long getUpdateFrequency(); void setUpdateFrequency(long updateFrequency); synchronized LatLon getPercentLatLon(double percent); synchronized Vec4 getSegmentCenterPoint(DrawContext dc, Segment segment, double top, double bottom,
			boolean followTerrain); synchronized SegmentGeometry getGeometry(DrawContext dc, CurtainTile tile, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Vec4[] getPointsInSegment(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Extent getSegmentExtent(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Angle getSegmentLength(Segment segment); synchronized double getSegmentLengthInRadians(Segment segment); synchronized Angle getPercentLength(double percent); synchronized double getPercentLengthInRadians(double percent); synchronized Sector getBoundingSector(); }
Path { public synchronized LatLon getPercentLatLon(double percent) { if (percent <= 0) { return positions.firstEntry().getValue(); } if (percent >= 1) { return positions.lastEntry().getValue(); } if (positions.containsKey(percent)) { return positions.get(percent); } Entry<Double, LatLon> lower = positions.lowerEntry(percent); Entry<Double, LatLon> higher = positions.higherEntry(percent); double p = (percent - lower.getKey()) / (higher.getKey() - lower.getKey()); return LatLon.interpolateGreatCircle(p, lower.getValue(), higher.getValue()); } Path(List<LatLon> positions); synchronized Angle getLength(); long getUpdateFrequency(); void setUpdateFrequency(long updateFrequency); synchronized LatLon getPercentLatLon(double percent); synchronized Vec4 getSegmentCenterPoint(DrawContext dc, Segment segment, double top, double bottom,
			boolean followTerrain); synchronized SegmentGeometry getGeometry(DrawContext dc, CurtainTile tile, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Vec4[] getPointsInSegment(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Extent getSegmentExtent(DrawContext dc, Segment segment, double top, double bottom,
			int subsegments, boolean followTerrain); synchronized Angle getSegmentLength(Segment segment); synchronized double getSegmentLengthInRadians(Segment segment); synchronized Angle getPercentLength(double percent); synchronized double getPercentLengthInRadians(double percent); synchronized Sector getBoundingSector();  }