Class StretchedVertex

java.lang.Object
org.locationtech.jtstest.testbuilder.topostretch.StretchedVertex

public class StretchedVertex extends 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.

  • Field Details

    • vertexPt

      private Coordinate vertexPt
    • parentLine

      private Coordinate[] parentLine
    • parentIndex

      private int parentIndex
    • nearPt

      private Coordinate nearPt
    • nearPts

      private Coordinate[] nearPts
    • nearIndex

      private int nearIndex
    • nearSeg

      private LineSegment nearSeg
    • stretchedPt

      private Coordinate stretchedPt
    • MAX_ARM_NEARNESS_ANG

      private static final double MAX_ARM_NEARNESS_ANG
      See Also:
    • POINT_LINE_FLATNESS_RATIO

      private static final double POINT_LINE_FLATNESS_RATIO
      See Also:
  • Constructor Details

    • 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 Details

    • 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)
    • displaceFromPoint

      private Coordinate displaceFromPoint(Coordinate nearPt, double dist)
    • displaceFromSeg

      private Coordinate displaceFromSeg(LineSegment nearSeg, double dist)
    • displaceFromVertex

      private Coordinate displaceFromVertex(Coordinate nearPt, double dist)
    • displaceFromCornerOriginal

      private Coordinate displaceFromCornerOriginal(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist)
    • displaceFromCorner

      private Coordinate displaceFromCorner(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist)
    • 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:
    • isInsideCorner

      private boolean isInsideCorner(Coordinate queryPt, Coordinate base, Coordinate p1, Coordinate p2)
    • isFlat

      private static boolean isFlat(Coordinate p, Coordinate p1, Coordinate p2)
    • 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
    • rotateToQuadrant

      private static Coordinate rotateToQuadrant(Coordinate v, int quadrant)
    • 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:
    • displaceFromFlatCorner

      private Coordinate displaceFromFlatCorner(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist)