Package org.locationtech.jts.algorithm
Class PolygonNodeTopology
java.lang.Object
org.locationtech.jts.algorithm.PolygonNodeTopology
Functions to compute topological information
about nodes (ring intersections) in polygonal geometry.
- Author:
- mdavis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
compareAngle
(Coordinate origin, Coordinate p, Coordinate q) Compares the angles of two vectors relative to the positive X-axis at their origin.static boolean
isCrossing
(Coordinate nodePt, Coordinate a0, Coordinate a1, Coordinate b0, Coordinate b1) Check if four segments at a node cross.static boolean
isInteriorSegment
(Coordinate nodePt, Coordinate a0, Coordinate a1, Coordinate b) Tests whether an segment node-b lies in the interior or exterior of a corner of a ring formed by the two segments a0-node-a1.
-
Constructor Details
-
PolygonNodeTopology
public PolygonNodeTopology()
-
-
Method Details
-
isCrossing
public static boolean isCrossing(Coordinate nodePt, Coordinate a0, Coordinate a1, Coordinate b0, Coordinate b1) Check if four segments at a node cross. Typically the segments lie in two different rings, or different sections of one ring. The node is topologically valid if the rings do not cross. If any segments are collinear, the test returns false.- Parameters:
nodePt
- the node locationa0
- the previous segment endpoint in a ringa1
- the next segment endpoint in a ringb0
- the previous segment endpoint in the other ringb1
- the next segment endpoint in the other ring- Returns:
- true if the rings cross at the node
-
isInteriorSegment
public static boolean isInteriorSegment(Coordinate nodePt, Coordinate a0, Coordinate a1, Coordinate b) Tests whether an segment node-b lies in the interior or exterior of a corner of a ring formed by the two segments a0-node-a1. The ring interior is assumed to be on the right of the corner (i.e. a CW shell or CCW hole). The test segment must not be collinear with the corner segments.- Parameters:
nodePt
- the node locationa0
- the first vertex of the cornera1
- the second vertex of the cornerb
- the other vertex of the test segment- Returns:
- true if the segment is interior to the ring corner
-
compareAngle
Compares the angles of two vectors relative to the positive X-axis at their origin. Angles increase CCW from the X-axis.- Parameters:
origin
- the origin of the vectorsp
- the endpoint of the vector Pq
- the endpoint of the vector Q- Returns:
- a negative integer, zero, or a positive integer as this vector P has angle less than, equal to, or greater than vector Q
-