Refactor, restoring isWithinSection and making sure it is properly called.

This commit is contained in:
Karl David Wright 2022-11-24 02:45:44 -05:00
parent b15ace46b2
commit b5dd71198d
1 changed files with 20 additions and 5 deletions

View File

@ -461,13 +461,30 @@ class GeoDegeneratePath extends GeoBasePath {
* @param x is the point x.
* @param y is the point y.
* @param z is the point z.
* @return true of within.
* @return true if within.
*/
@Override
public boolean isWithin(final double x, final double y, final double z) {
return this.point.isIdentical(x, y, z);
}
/**
* Check if point is within the section handled by this endpoint.
*
* @param x is the point x.
* @param y is the point y.
* @param z is the point z.
* @return true if within.
*/
public boolean isWithinSection(final double x, final double y, final double z) {
for (final Membership m : cutoffPlanes) {
if (!m.isWithin(x, y, z)) {
return false;
}
}
return true;
}
/**
* Compute interior path distance.
*
@ -497,10 +514,8 @@ class GeoDegeneratePath extends GeoBasePath {
*/
public double pathCenterDistance(
final DistanceStyle distanceStyle, final double x, final double y, final double z) {
for (final Membership m : cutoffPlanes) {
if (!m.isWithin(x, y, z)) {
return Double.POSITIVE_INFINITY;
}
if (!isWithinSection(x, y, z)) {
return Double.POSITIVE_INFINITY;
}
return distanceStyle.toAggregationForm(distanceStyle.computeDistance(this.point, x, y, z));
}