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 doubleprivate intprivate Coordinateprivate Coordinate[]private LineSegmentprivate intprivate Coordinate[]private static final doubleprivate Coordinateprivate 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 CoordinatedisplaceFromCorner(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) private CoordinatedisplaceFromCornerAwayFromArms(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 CoordinatedisplaceFromCornerOriginal(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) private CoordinatedisplaceFromFlatCorner(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) private CoordinatedisplaceFromPoint(Coordinate nearPt, double dist) private CoordinatedisplaceFromSeg(LineSegment nearSeg, double dist) private CoordinatedisplaceFromVertex(Coordinate nearPt, double dist) private CoordinategetNearRingPoint(int i) getStretchedVertex(double dist) Gets the point which this near vertex will be stretched to (by a given distance)private static booleanisFlat(Coordinate p, Coordinate p1, Coordinate p2) private booleanisInsideCorner(Coordinate queryPt, Coordinate base, Coordinate p1, Coordinate p2) private booleanprivate static doublemaxAngleToBisector(double ang) private static Vector2DnormalizedOffset(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 intquadrant(Coordinate pt, Coordinate cornerBase, Coordinate[] corner) private static CoordinaterotateToQuadrant(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)
-