Class StretchedVertex
java.lang.Object
org.locationtech.jtstest.testbuilder.topostretch.StretchedVertex
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
private int
private Coordinate
private Coordinate[]
private LineSegment
private int
private Coordinate[]
private static final double
private Coordinate
private Coordinate
-
Constructor Summary
ConstructorsConstructorDescriptionStretchedVertex
(Coordinate vertexPt, Coordinate[] parentLine, int parentIndex, Coordinate nearPt, Coordinate[] nearPts, int nearIndex) Creates a vertex which lies near a vertexStretchedVertex
(Coordinate vertexPt, Coordinate[] parentLine, int parentIndex, LineSegment nearSeg) Creates a vertex for a point which lies near a line segment -
Method Summary
Modifier and TypeMethodDescriptionprivate Coordinate
displaceFromCorner
(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) 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.private Coordinate
displaceFromCornerOriginal
(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) private Coordinate
displaceFromFlatCorner
(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) private Coordinate
displaceFromPoint
(Coordinate nearPt, double dist) private Coordinate
displaceFromSeg
(LineSegment nearSeg, double dist) private Coordinate
displaceFromVertex
(Coordinate nearPt, double dist) private Coordinate
getNearRingPoint
(int i) getStretchedVertex
(double dist) Gets the point which this near vertex will be stretched to (by a given distance)private static boolean
isFlat
(Coordinate p, Coordinate p1, Coordinate p2) private boolean
isInsideCorner
(Coordinate queryPt, Coordinate base, Coordinate p1, Coordinate p2) private boolean
private static double
maxAngleToBisector
(double ang) private static Vector2D
normalizedOffset
(Coordinate p0, Coordinate p1, Coordinate p2) Returns an array of pts such that p0 - p[0] - [p1] is CW.private static Coordinate[]
orientCorner
(Coordinate p0, Coordinate p1, Coordinate p2) Returns an array of pts such that p0 - p[0] - [p1] is CW.private static int
quadrant
(Coordinate pt, Coordinate cornerBase, Coordinate[] corner) private static Coordinate
rotateToQuadrant
(Coordinate v, int quadrant)
-
Field Details
-
vertexPt
-
parentLine
-
parentIndex
private int parentIndex -
nearPt
-
nearPts
-
nearIndex
private int nearIndex -
nearSeg
-
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
-
getStretchedVertex
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
-
displaceFromPoint
-
displaceFromSeg
-
displaceFromVertex
-
displaceFromCornerOriginal
private Coordinate displaceFromCornerOriginal(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) -
displaceFromCorner
-
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
-
isFlat
-
quadrant
- Parameters:
pt
-cornerBase
- the two vertices defining thecorner
- the two vertices defining the arms of the corner, oriented CW- Returns:
- the quadrant the pt lies in
-
rotateToQuadrant
-
orientCorner
Returns an array of pts such that p0 - p[0] - [p1] is CW.- Parameters:
p0
-p1
-p2
-- Returns:
-
normalizedOffset
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)
-