/** Compute the full distance along this path segment. *@param distanceStyle is the distance style. *@return the distance metric, in aggregation form. */ public double fullPathDistance(final DistanceStyle distanceStyle) { synchronized (fullDistanceCache) { Double dist = fullDistanceCache.get(distanceStyle); if (dist == null) { dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z)); fullDistanceCache.put(distanceStyle, dist); } return dist.doubleValue(); } }
/** Compute nearest path distance. *@param distanceStyle is the distance style. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return the distance metric (always value zero), in aggregation form, or POSITIVE_INFINITY * if the point is not within the bounds of the endpoint. */ public double nearestPathDistance(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; } } return distanceStyle.toAggregationForm(0.0); }
/** Compute the full distance along this path segment. *@param distanceStyle is the distance style. *@return the distance metric, in aggregation form. */ public double fullPathDistance(final DistanceStyle distanceStyle) { synchronized (fullDistanceCache) { Double dist = fullDistanceCache.get(distanceStyle); if (dist == null) { dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z)); fullDistanceCache.put(distanceStyle, dist); } return dist.doubleValue(); } }
/** Compute nearest path distance. *@param distanceStyle is the distance style. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return the distance metric (always value zero), in aggregation form, or POSITIVE_INFINITY * if the point is not within the bounds of the endpoint. */ public double nearestPathDistance(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; } } return distanceStyle.toAggregationForm(0.0); }
/** Compute interior path distance. *@param distanceStyle is the distance style. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return the distance metric, in aggregation form. */ public double pathDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) { if (!isWithin(x,y,z)) return Double.POSITIVE_INFINITY; return distanceStyle.toAggregationForm(distanceStyle.computeDistance(this.point, x, y, z)); }
/** Compute interior path distance. *@param distanceStyle is the distance style. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return the distance metric, in aggregation form. */ public double pathDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) { if (!isWithin(x,y,z)) return Double.POSITIVE_INFINITY; return distanceStyle.toAggregationForm(distanceStyle.computeDistance(this.point, x, y, z)); }
/** Compute delta path distance. *@param distanceStyle is the distance style. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return the distance metric, in aggregation form. */ public double pathDeltaDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) { if (!isWithin(x,y,z)) return Double.POSITIVE_INFINITY; final double theDistance = distanceStyle.toAggregationForm(distanceStyle.computeDistance(this.point, x, y, z)); return distanceStyle.aggregateDistances(theDistance, theDistance); }
final double magnitude = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ); if (Math.abs(magnitude) < Vector.MINIMUM_RESOLUTION) return distanceStyle.toAggregationForm(0.0); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0); throw new RuntimeException("Can't find world intersection for point x="+x+" y="+y+" z="+z); return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, thePoint.x, thePoint.y, thePoint.z));
final double magnitude = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ); if (Math.abs(magnitude) < Vector.MINIMUM_RESOLUTION) return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, x,y,z)); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0); throw new RuntimeException("Can't find world intersection for point x="+x+" y="+y+" z="+z); return distanceStyle.aggregateDistances(distanceStyle.toAggregationForm(distanceStyle.computeDistance(thePoint, x, y, z)), distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, thePoint.x, thePoint.y, thePoint.z)));
final double magnitude = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ); if (Math.abs(magnitude) < Vector.MINIMUM_RESOLUTION) return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, x,y,z)); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0); throw new RuntimeException("Can't find world intersection for point x="+x+" y="+y+" z="+z); return distanceStyle.aggregateDistances(distanceStyle.toAggregationForm(distanceStyle.computeDistance(thePoint, x, y, z)), distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, thePoint.x, thePoint.y, thePoint.z)));
final double magnitude = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ); if (Math.abs(magnitude) < Vector.MINIMUM_RESOLUTION) return distanceStyle.toAggregationForm(0.0); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0); throw new RuntimeException("Can't find world intersection for point x="+x+" y="+y+" z="+z); return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, thePoint.x, thePoint.y, thePoint.z));
throw new RuntimeException("Can't find world intersection for point x="+x+" y="+y+" z="+z); final double theDistance = distanceStyle.toAggregationForm(distanceStyle.computeDistance(thePoint, x, y, z)); return distanceStyle.aggregateDistances(theDistance, theDistance);