Class StretchedVertex


  • public class StretchedVertex
    extends java.lang.Object
    Models a vertex of a Geometry which will be stretched due to being too near other segments and vertices.

    Currently for simplicity a vertex is assumed to be near only one segment or other vertex. This is sufficient for most cases.

    • Constructor Detail

      • StretchedVertex

        public StretchedVertex​(Coordinate vertexPt,
                               Coordinate[] parentLine,
                               int parentIndex,
                               Coordinate nearPt,
                               Coordinate[] nearPts,
                               int nearIndex)
        Creates a vertex which lies near a vertex
      • StretchedVertex

        public StretchedVertex​(Coordinate vertexPt,
                               Coordinate[] parentLine,
                               int parentIndex,
                               LineSegment nearSeg)
        Creates a vertex for a point which lies near a line segment
        Parameters:
        vertexPt -
        parentLine -
        parentIndex -
        nearSeg -
    • Method Detail

      • getVertexCoordinate

        public Coordinate getVertexCoordinate()
      • getStretchedVertex

        public Coordinate getStretchedVertex​(double dist)
        Gets the point which this near vertex will be stretched to (by a given distance)
        Parameters:
        dist - the distance to adjust the point by
        Returns:
        the stretched coordinate
      • isNearRing

        private boolean isNearRing()
      • getNearRingPoint

        private Coordinate getNearRingPoint​(int i)
      • maxAngleToBisector

        private static double maxAngleToBisector​(double ang)
      • displaceFromCornerAwayFromArms

        private Coordinate displaceFromCornerAwayFromArms​(Coordinate nearPt,
                                                          Coordinate p1,
                                                          Coordinate p2,
                                                          double dist)
        Displaces a vertex from a corner, with angle limiting used to ensure that the displacement is not close to the arms of the corner.
        Parameters:
        nearPt -
        p1 -
        p2 -
        dist -
        Returns:
      • quadrant

        private static int quadrant​(Coordinate pt,
                                    Coordinate cornerBase,
                                    Coordinate[] corner)
        Parameters:
        pt -
        cornerBase - the two vertices defining the
        corner - the two vertices defining the arms of the corner, oriented CW
        Returns:
        the quadrant the pt lies in
      • orientCorner

        private static Coordinate[] orientCorner​(Coordinate p0,
                                                 Coordinate p1,
                                                 Coordinate p2)
        Returns an array of pts such that p0 - p[0] - [p1] is CW.
        Parameters:
        p0 -
        p1 -
        p2 -
        Returns:
      • normalizedOffset

        private static Vector2D normalizedOffset​(Coordinate p0,
                                                 Coordinate p1,
                                                 Coordinate p2)
        Returns an array of pts such that p0 - p[0] - [p1] is CW.
        Parameters:
        p0 -
        p1 -
        p2 -
        Returns: