mirror of https://github.com/apache/lucene.git
LUCENE-7288: Return POSITIVE_INFINITY for points outside of shape, not MAX_VALUE.
This commit is contained in:
parent
07af00d8e7
commit
a911eb8561
|
@ -44,7 +44,7 @@ public abstract class GeoBaseDistanceShape extends GeoBaseMembershipShape implem
|
||||||
@Override
|
@Override
|
||||||
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
if (!isWithin(x,y,z)) {
|
if (!isWithin(x,y,z)) {
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
return distance(distanceStyle, x, y, z);
|
return distance(distanceStyle, x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -54,14 +54,14 @@ public abstract class GeoBaseDistanceShape extends GeoBaseMembershipShape implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDistanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue) {
|
public void getDistanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue) {
|
||||||
if (distanceValue == Double.MAX_VALUE) {
|
if (distanceValue == Double.POSITIVE_INFINITY) {
|
||||||
getBounds(bounds);
|
getBounds(bounds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
distanceBounds(bounds, distanceStyle, distanceValue);
|
distanceBounds(bounds, distanceStyle, distanceValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called by a {@code getDistanceBounds} method if distanceValue is not Double.MAX_VALUE. */
|
/** Called by a {@code getDistanceBounds} method if distanceValue is not Double.POSITIVE_INFINITY. */
|
||||||
protected abstract void distanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue);
|
protected abstract void distanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
|
||||||
final GeoPoint[] ZIntersectionsY = travelPlaneFixedZ.findIntersections(planetModel, testPointFixedYPlane);
|
final GeoPoint[] ZIntersectionsY = travelPlaneFixedZ.findIntersections(planetModel, testPointFixedYPlane);
|
||||||
|
|
||||||
// There will be multiple intersection points found. We choose the one that has the lowest total distance, as measured in delta X, delta Y, and delta Z.
|
// There will be multiple intersection points found. We choose the one that has the lowest total distance, as measured in delta X, delta Y, and delta Z.
|
||||||
double bestDistance = Double.MAX_VALUE;
|
double bestDistance = Double.POSITIVE_INFINITY;
|
||||||
double firstLegValue = 0.0;
|
double firstLegValue = 0.0;
|
||||||
double secondLegValue = 0.0;
|
double secondLegValue = 0.0;
|
||||||
Plane firstLegPlane = null;
|
Plane firstLegPlane = null;
|
||||||
|
@ -323,7 +323,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert bestDistance > 0.0 : "Best distance should not be zero unless on single plane";
|
assert bestDistance > 0.0 : "Best distance should not be zero unless on single plane";
|
||||||
assert bestDistance < Double.MAX_VALUE : "Couldn't find an intersection point of any kind";
|
assert bestDistance < Double.POSITIVE_INFINITY : "Couldn't find an intersection point of any kind";
|
||||||
|
|
||||||
final DualCrossingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(firstLegPlane, firstLegAbovePlane, firstLegBelowPlane, secondLegPlane, x, y, z, intersectionPoint);
|
final DualCrossingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(firstLegPlane, firstLegAbovePlane, firstLegBelowPlane, secondLegPlane, x, y, z, intersectionPoint);
|
||||||
if (!firstLegTree.traverse(edgeIterator, firstLegValue)) {
|
if (!firstLegTree.traverse(edgeIterator, firstLegValue)) {
|
||||||
|
@ -390,7 +390,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
double minimumDistance = Double.MAX_VALUE;
|
double minimumDistance = Double.POSITIVE_INFINITY;
|
||||||
for (final Edge shapeStartEdge : shapeStartEdges) {
|
for (final Edge shapeStartEdge : shapeStartEdges) {
|
||||||
Edge shapeEdge = shapeStartEdge;
|
Edge shapeEdge = shapeStartEdge;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class GeoCompositeMembershipShape implements GeoMembershipShape {
|
||||||
public double computeOutsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
public double computeOutsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
if (isWithin(x,y,z))
|
if (isWithin(x,y,z))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
double distance = Double.MAX_VALUE;
|
double distance = Double.POSITIVE_INFINITY;
|
||||||
for (GeoMembershipShape shape : shapes) {
|
for (GeoMembershipShape shape : shapes) {
|
||||||
final double normalDistance = shape.computeOutsideDistance(distanceStyle, x, y, z);
|
final double normalDistance = shape.computeOutsideDistance(distanceStyle, x, y, z);
|
||||||
if (normalDistance < distance) {
|
if (normalDistance < distance) {
|
||||||
|
|
|
@ -409,7 +409,7 @@ class GeoConcavePolygon extends GeoBasePolygon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
double minimumDistance = Double.MAX_VALUE;
|
double minimumDistance = Double.POSITIVE_INFINITY;
|
||||||
for (final GeoPoint edgePoint : points) {
|
for (final GeoPoint edgePoint : points) {
|
||||||
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
|
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
|
||||||
if (newDist < minimumDistance) {
|
if (newDist < minimumDistance) {
|
||||||
|
|
|
@ -397,7 +397,7 @@ class GeoConvexPolygon extends GeoBasePolygon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
double minimumDistance = Double.MAX_VALUE;
|
double minimumDistance = Double.POSITIVE_INFINITY;
|
||||||
for (final GeoPoint edgePoint : points) {
|
for (final GeoPoint edgePoint : points) {
|
||||||
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
|
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
|
||||||
if (newDist < minimumDistance) {
|
if (newDist < minimumDistance) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ class GeoDegeneratePoint extends GeoPoint implements GeoBBox, GeoCircle {
|
||||||
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
if (isWithin(x,y,z))
|
if (isWithin(x,y,z))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,13 +26,13 @@ package org.apache.lucene.spatial3d.geom;
|
||||||
public interface GeoDistance extends Membership {
|
public interface GeoDistance extends Membership {
|
||||||
|
|
||||||
// The following methods compute distances from the shape to a point
|
// The following methods compute distances from the shape to a point
|
||||||
// expected to be INSIDE the shape. Typically a value of Double.MAX_VALUE
|
// expected to be INSIDE the shape. Typically a value of Double.POSITIVE_INFINITY
|
||||||
// is returned for points that happen to be outside the shape.
|
// is returned for points that happen to be outside the shape.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute this shape's <em>internal</em> "distance" to the GeoPoint.
|
* Compute this shape's <em>internal</em> "distance" to the GeoPoint.
|
||||||
* Implementations should clarify how this is computed when it's non-obvious.
|
* Implementations should clarify how this is computed when it's non-obvious.
|
||||||
* A return value of Double.MAX_VALUE should be returned for
|
* A return value of Double.POSITIVE_INFINITY should be returned for
|
||||||
* points outside of the shape.
|
* points outside of the shape.
|
||||||
*
|
*
|
||||||
* @param distanceStyle is the distance style.
|
* @param distanceStyle is the distance style.
|
||||||
|
@ -46,7 +46,7 @@ public interface GeoDistance extends Membership {
|
||||||
/**
|
/**
|
||||||
* Compute this shape's <em>internal</em> "distance" to the GeoPoint.
|
* Compute this shape's <em>internal</em> "distance" to the GeoPoint.
|
||||||
* Implementations should clarify how this is computed when it's non-obvious.
|
* Implementations should clarify how this is computed when it's non-obvious.
|
||||||
* A return value of Double.MAX_VALUE should be returned for
|
* A return value of Double.POSITIVE_INFINITY should be returned for
|
||||||
* points outside of the shape.
|
* points outside of the shape.
|
||||||
*
|
*
|
||||||
* @param x is the point's unit x coordinate (using U.S. convention).
|
* @param x is the point's unit x coordinate (using U.S. convention).
|
||||||
|
|
|
@ -201,7 +201,7 @@ class GeoStandardPath extends GeoBasePath {
|
||||||
double currentDistance = 0.0;
|
double currentDistance = 0.0;
|
||||||
for (PathSegment segment : segments) {
|
for (PathSegment segment : segments) {
|
||||||
double distance = segment.pathDistance(planetModel, distanceStyle, x,y,z);
|
double distance = segment.pathDistance(planetModel, distanceStyle, x,y,z);
|
||||||
if (distance != Double.MAX_VALUE)
|
if (distance != Double.POSITIVE_INFINITY)
|
||||||
return currentDistance + distance;
|
return currentDistance + distance;
|
||||||
currentDistance += segment.fullPathDistance(distanceStyle);
|
currentDistance += segment.fullPathDistance(distanceStyle);
|
||||||
}
|
}
|
||||||
|
@ -210,13 +210,13 @@ class GeoStandardPath extends GeoBasePath {
|
||||||
currentDistance = 0.0;
|
currentDistance = 0.0;
|
||||||
for (SegmentEndpoint endpoint : endPoints) {
|
for (SegmentEndpoint endpoint : endPoints) {
|
||||||
double distance = endpoint.pathDistance(distanceStyle, x, y, z);
|
double distance = endpoint.pathDistance(distanceStyle, x, y, z);
|
||||||
if (distance != Double.MAX_VALUE)
|
if (distance != Double.POSITIVE_INFINITY)
|
||||||
return currentDistance + distance;
|
return currentDistance + distance;
|
||||||
if (segmentIndex < segments.size())
|
if (segmentIndex < segments.size())
|
||||||
currentDistance += segments.get(segmentIndex++).fullPathDistance(distanceStyle);
|
currentDistance += segments.get(segmentIndex++).fullPathDistance(distanceStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -227,7 +227,7 @@ class GeoStandardPath extends GeoBasePath {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
double minDistance = Double.MAX_VALUE;
|
double minDistance = Double.POSITIVE_INFINITY;
|
||||||
for (final SegmentEndpoint endpoint : endPoints) {
|
for (final SegmentEndpoint endpoint : endPoints) {
|
||||||
final double newDistance = endpoint.outsideDistance(distanceStyle, x,y,z);
|
final double newDistance = endpoint.outsideDistance(distanceStyle, x,y,z);
|
||||||
if (newDistance < minDistance)
|
if (newDistance < minDistance)
|
||||||
|
@ -518,7 +518,7 @@ class GeoStandardPath extends GeoBasePath {
|
||||||
*/
|
*/
|
||||||
public double pathDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
public double pathDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
if (!isWithin(x,y,z))
|
if (!isWithin(x,y,z))
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
return distanceStyle.computeDistance(this.point, x, y, z);
|
return distanceStyle.computeDistance(this.point, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ class GeoStandardPath extends GeoBasePath {
|
||||||
*/
|
*/
|
||||||
public double pathDistance(final PlanetModel planetModel, final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
public double pathDistance(final PlanetModel planetModel, final DistanceStyle distanceStyle, final double x, final double y, final double z) {
|
||||||
if (!isWithin(x,y,z))
|
if (!isWithin(x,y,z))
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
|
|
||||||
// (1) Compute normalizedPerpPlane. If degenerate, then return point distance from start to point.
|
// (1) Compute normalizedPerpPlane. If degenerate, then return point distance from start to point.
|
||||||
// Want no allocations or expensive operations! so we do this the hard way
|
// Want no allocations or expensive operations! so we do this the hard way
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class Plane extends Vector {
|
||||||
if (evaluateIsZero(x,y,z)) {
|
if (evaluateIsZero(x,y,z)) {
|
||||||
if (meetsAllBounds(x,y,z, bounds))
|
if (meetsAllBounds(x,y,z, bounds))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, compute the perpendicular plane.
|
// First, compute the perpendicular plane.
|
||||||
|
@ -307,7 +307,7 @@ public class Plane extends Vector {
|
||||||
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
|
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
|
||||||
|
|
||||||
// For each point, compute a linear distance, and take the minimum of them
|
// For each point, compute a linear distance, and take the minimum of them
|
||||||
double minDistance = Double.MAX_VALUE;
|
double minDistance = Double.POSITIVE_INFINITY;
|
||||||
|
|
||||||
for (final GeoPoint intersectionPoint : intersectionPoints) {
|
for (final GeoPoint intersectionPoint : intersectionPoints) {
|
||||||
if (meetsAllBounds(intersectionPoint, bounds)) {
|
if (meetsAllBounds(intersectionPoint, bounds)) {
|
||||||
|
@ -347,7 +347,7 @@ public class Plane extends Vector {
|
||||||
final double perpZ = z - dist * this.z;
|
final double perpZ = z - dist * this.z;
|
||||||
|
|
||||||
if (!meetsAllBounds(perpX, perpY, perpZ, bounds)) {
|
if (!meetsAllBounds(perpX, perpY, perpZ, bounds)) {
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.abs(dist);
|
return Math.abs(dist);
|
||||||
|
@ -373,7 +373,7 @@ public class Plane extends Vector {
|
||||||
*/
|
*/
|
||||||
public double normalDistanceSquared(final double x, final double y, final double z, final Membership... bounds) {
|
public double normalDistanceSquared(final double x, final double y, final double z, final Membership... bounds) {
|
||||||
final double normal = normalDistance(x,y,z,bounds);
|
final double normal = normalDistance(x,y,z,bounds);
|
||||||
if (normal == Double.MAX_VALUE)
|
if (normal == Double.POSITIVE_INFINITY)
|
||||||
return normal;
|
return normal;
|
||||||
return normal * normal;
|
return normal * normal;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ public class Plane extends Vector {
|
||||||
if (evaluateIsZero(x,y,z)) {
|
if (evaluateIsZero(x,y,z)) {
|
||||||
if (meetsAllBounds(x,y,z, bounds))
|
if (meetsAllBounds(x,y,z, bounds))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
return Double.MAX_VALUE;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, compute the perpendicular plane.
|
// First, compute the perpendicular plane.
|
||||||
|
@ -419,7 +419,7 @@ public class Plane extends Vector {
|
||||||
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
|
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
|
||||||
|
|
||||||
// For each point, compute a linear distance, and take the minimum of them
|
// For each point, compute a linear distance, and take the minimum of them
|
||||||
double minDistance = Double.MAX_VALUE;
|
double minDistance = Double.POSITIVE_INFINITY;
|
||||||
|
|
||||||
for (final GeoPoint intersectionPoint : intersectionPoints) {
|
for (final GeoPoint intersectionPoint : intersectionPoints) {
|
||||||
if (meetsAllBounds(intersectionPoint, bounds)) {
|
if (meetsAllBounds(intersectionPoint, bounds)) {
|
||||||
|
|
|
@ -27,9 +27,9 @@ public class GeoCircleTest extends LuceneTestCase {
|
||||||
GeoPoint gp;
|
GeoPoint gp;
|
||||||
c = GeoCircleFactory.makeGeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
|
c = GeoCircleFactory.makeGeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
|
||||||
assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
||||||
assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
|
||||||
assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
|
||||||
assertEquals(0.0, c.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(0.0, c.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
assertEquals(0.0, c.computeDistance(DistanceStyle.NORMAL,gp), 0.000001);
|
assertEquals(0.0, c.computeDistance(DistanceStyle.NORMAL,gp), 0.000001);
|
||||||
|
|
|
@ -36,13 +36,13 @@ public class GeoPathTest {
|
||||||
p.addPoint(0.0, 0.2);
|
p.addPoint(0.0, 0.2);
|
||||||
p.done();
|
p.done();
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.15);
|
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.15);
|
||||||
assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.15);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.15);
|
||||||
assertEquals(0.15 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(0.15 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.12);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.12);
|
||||||
assertEquals(0.12 + 0.0, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(0.12 + 0.0, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, -0.15, 0.05);
|
gp = new GeoPoint(PlanetModel.SPHERE, -0.15, 0.05);
|
||||||
assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.25);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.25);
|
||||||
assertEquals(0.20 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(0.20 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.05);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.05);
|
||||||
|
@ -65,9 +65,9 @@ public class GeoPathTest {
|
||||||
p.addPoint(Math.PI * 0.25, -0.5);
|
p.addPoint(Math.PI * 0.25, -0.5);
|
||||||
p.done();
|
p.done();
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
|
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
|
||||||
assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.0);
|
gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.0);
|
||||||
assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.25 + 0.05, -0.5);
|
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.25 + 0.05, -0.5);
|
||||||
assertEquals(Math.PI * 0.5 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
assertEquals(Math.PI * 0.5 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
|
||||||
gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.05, -0.5);
|
gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.05, -0.5);
|
||||||
|
|
Loading…
Reference in New Issue