use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class SphericalEarthMathTest method testDistanceOfPolylineIsZeroForOnePosition.
public void testDistanceOfPolylineIsZeroForOnePosition() {
List<LatLon> positions = new ArrayList<>();
positions.add(new OsmLatLon(0, 0));
assertEquals(0.0, SphericalEarthMath.distance(positions));
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class SphericalEarthMathTest method testDistanceOfPolylineForTwoPositions.
public void testDistanceOfPolylineForTwoPositions() {
List<LatLon> positions = new ArrayList<>();
LatLon p0 = new OsmLatLon(0, 0);
LatLon p1 = new OsmLatLon(1, 1);
positions.add(p0);
positions.add(p1);
assertEquals(SphericalEarthMath.distance(p0, p1), SphericalEarthMath.distance(positions));
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class SphericalEarthMathTest method testEnclosingBoundingBoxLine.
public void testEnclosingBoundingBoxLine() {
List<LatLon> positions = new ArrayList<>();
positions.add(new OsmLatLon(-4, 0));
positions.add(new OsmLatLon(12, 3));
positions.add(new OsmLatLon(1, 16));
positions.add(new OsmLatLon(0, -6));
BoundingBox bbox = SphericalEarthMath.enclosingBoundingBox(positions);
assertEquals(-4.0, bbox.getMinLatitude());
assertEquals(12.0, bbox.getMaxLatitude());
assertEquals(16.0, bbox.getMaxLongitude());
assertEquals(-6.0, bbox.getMinLongitude());
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class SphericalEarthMathTest method testShortDistance.
public void testShortDistance() {
LatLon one = new OsmLatLon(53.5712482, 9.9782365);
LatLon two = new OsmLatLon(53.5712528, 9.9782517);
assertEquals(1, (int) SphericalEarthMath.distance(one, two));
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class SphericalEarthMathTest method checkTranslate.
private void checkTranslate(int distance, int angle) {
LatLon one = new OsmLatLon(53.5712482, 9.9782365);
checkTranslate(one, distance, angle);
}
Aggregations