Class GeoStandardPath.PathSegment

All Implemented Interfaces:
Bounded, GeoBounds, GeoStandardPath.PathComponent, Membership, PlanetObject, SerializableObject
Enclosing class:
GeoStandardPath

private static class GeoStandardPath.PathSegment extends GeoBaseBounds implements GeoStandardPath.PathComponent
This is the pre-calculated data for a path segment.
  • Field Details

    • previous

      public final GeoStandardPath.PathComponent previous
      Previous path component
    • start

      public final GeoPoint start
      Starting point of the segment
    • end

      public final GeoPoint end
      End point of the segment
    • startDistanceCache

      public final Map<DistanceStyle,Double> startDistanceCache
      Place to keep any complete segment distances we've calculated so far
    • normalizedConnectingPlane

      public final Plane normalizedConnectingPlane
      Normalized plane connecting the two points and going through world center
    • upperConnectingPlane

      public final SidedPlane upperConnectingPlane
      Cutoff plane parallel to connecting plane representing one side of the path segment
    • lowerConnectingPlane

      public final SidedPlane lowerConnectingPlane
      Cutoff plane parallel to connecting plane representing the other side of the path segment
    • startCutoffPlane

      public final SidedPlane startCutoffPlane
      Plane going through the center and start point, marking the start edge of the segment
    • endCutoffPlane

      public final SidedPlane endCutoffPlane
      Plane going through the center and end point, marking the end edge of the segment
    • URHC

      public final GeoPoint URHC
      Upper right hand corner of segment
    • LRHC

      public final GeoPoint LRHC
      Lower right hand corner of segment
    • ULHC

      public final GeoPoint ULHC
      Upper left hand corner of segment
    • LLHC

      public final GeoPoint LLHC
      Lower left hand corner of segment
    • upperConnectingPlanePoints

      public final GeoPoint[] upperConnectingPlanePoints
      Notable points for the upper connecting plane
    • lowerConnectingPlanePoints

      public final GeoPoint[] lowerConnectingPlanePoints
      Notable points for the lower connecting plane
  • Constructor Details

    • PathSegment

      public PathSegment(PlanetModel planetModel, GeoStandardPath.PathComponent previous, GeoPoint start, GeoPoint end, Plane normalizedConnectingPlane, double planeBoundingOffset)
      Construct a path segment.
      Parameters:
      planetModel - is the planet model.
      start - is the starting point.
      end - is the ending point.
      normalizedConnectingPlane - is the connecting plane.
      planeBoundingOffset - is the linear offset from the connecting plane to either side.
  • Method Details

    • fullPathDistance

      public double fullPathDistance(DistanceStyle distanceStyle)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute the total distance this path component adds to the path.
      Specified by:
      fullPathDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      Returns:
      the full path distance.
    • isWithin

      public boolean isWithin(double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Check if point is within this endpoint.
      Specified by:
      isWithin in interface GeoStandardPath.PathComponent
      Specified by:
      isWithin in interface Membership
      Parameters:
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      true of within.
    • isWithin

      public boolean isWithin(Vector v)
      Description copied from interface: GeoStandardPath.PathComponent
      Check if point is within this endpoint.
      Specified by:
      isWithin in interface GeoStandardPath.PathComponent
      Specified by:
      isWithin in interface Membership
      Parameters:
      v - is the point.
      Returns:
      true of within.
    • isWithinSection

      public boolean isWithinSection(Vector point)
      Description copied from interface: GeoStandardPath.PathComponent
      Check if point is within this section (within cutoff planes).
      Specified by:
      isWithinSection in interface GeoStandardPath.PathComponent
    • isWithinSection

      public boolean isWithinSection(double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Check if point is within this section (within cutoff planes).
      Specified by:
      isWithinSection in interface GeoStandardPath.PathComponent
    • getStartingDistance

      public double getStartingDistance(DistanceStyle distanceStyle)
      Description copied from interface: GeoStandardPath.PathComponent
      Retrieve the starting distance along the path for this path element.
      Specified by:
      getStartingDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style
      Returns:
      the starting path distance in aggregation form
    • distance

      public double distance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute distance measure starting from beginning of the path and including perpendicular dog-leg to a point within the corridor.
      Specified by:
      distance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style
      x - is the x coordinate of the point we want to get the distance to
      y - is the y coordinate of the point we want to get the distance to
      z - is the z coordinate of the point we want to get the distance to
      Returns:
      the distance from start of path
    • nearestDistance

      public GeoStandardPath.DistancePair nearestDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Get the nearest distance for a point. This is the old "legacy" computation: We find the segment endpoint or path segment with the closest pathCenterDistance(), and keep track of the one where that's at a minimum. We then compute nearestPathDistance() if it's a segment and add that to fullPathDistance() computed along the entire path up to that point.

      So what we are minimizing is not what we are returning here. That is why this is tricky to modularize; we need to return two values: the best pathCenterDistance, and the corresponding nearestPathDistance + startingDistance.

      Specified by:
      nearestDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style
      x - is the x coordinate of the point we want to get the distance to
      y - is the y coordinate of the point we want to get the distance to
      z - is the z coordinate of the point we want to get the distance to
      Returns:
      the DistancePair containing both distances described above
    • computeStartingDistance

      private double computeStartingDistance(DistanceStyle distanceStyle)
    • pathCenterDistance

      public double pathCenterDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute path center distance (distance from the point to center of the path, if reachable by this segment).
      Specified by:
      pathCenterDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      the distance metric, or POSITIVE_INFINITY if the point is not within the bounds of the path segment.
    • nearestPathDistance

      public double nearestPathDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute nearest path distance (distance from start of segment to point adjacent the one specitied, if reachable by this segment).
      Specified by:
      nearestPathDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      the distance metric, in aggregation form.
    • pathDeltaDistance

      public double pathDeltaDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute delta path distance.
      Specified by:
      pathDeltaDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      the distance metric, in aggregation form.
    • pathDistance

      public double pathDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute path distance.
      Specified by:
      pathDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      the distance
    • outsideDistance

      public double outsideDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoStandardPath.PathComponent
      Compute external distance.
      Specified by:
      outsideDistance in interface GeoStandardPath.PathComponent
      Parameters:
      distanceStyle - is the distance style.
      x - is the point x.
      y - is the point y.
      z - is the point z.
      Returns:
      the distance metric.
    • intersects

      public boolean intersects(Plane p, XYZBounds planeBounds, GeoPoint[] notablePoints, Membership[] bounds)
      Description copied from interface: GeoStandardPath.PathComponent
      Determine if this endpoint intersects a specified plane.
      Specified by:
      intersects in interface GeoStandardPath.PathComponent
      Parameters:
      p - is the plane.
      planeBounds - are the XYZBounds of the plane we're looking for an intersection with.
      notablePoints - are the points associated with the plane.
      bounds - are any bounds which the intersection must lie within.
      Returns:
      true if there is a matching intersection.
    • intersects

      public boolean intersects(GeoShape geoShape)
      Description copied from interface: GeoStandardPath.PathComponent
      Determine if this endpoint intersects a GeoShape.
      Specified by:
      intersects in interface GeoStandardPath.PathComponent
      Parameters:
      geoShape - is the GeoShape.
      Returns:
      true if there is shape intersect this endpoint.
    • getBounds

      public void getBounds(Bounds bounds)
      Description copied from interface: Bounded
      Compute bounds for the shape.
      Specified by:
      getBounds in interface Bounded
      Specified by:
      getBounds in interface GeoStandardPath.PathComponent
      Overrides:
      getBounds in class GeoBaseBounds
      Parameters:
      bounds - is the input bounds object. The input object will be modified.
    • toString

      public String toString()
      Overrides:
      toString in class Object