Class PolygonNodeTopology


  • public class PolygonNodeTopology
    extends Object
    Functions to compute topological information about nodes (ring intersections) in polygonal geometry.
    Author:
    mdavis
    • Constructor Detail

      • PolygonNodeTopology

        public PolygonNodeTopology()
    • Method Detail

      • 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 location
        a0 - the previous segment endpoint in a ring
        a1 - the next segment endpoint in a ring
        b0 - the previous segment endpoint in the other ring
        b1 - 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 location
        a0 - the first vertex of the corner
        a1 - the second vertex of the corner
        b - the other vertex of the test segment
        Returns:
        true if the segment is interior to the ring corner
      • compareAngle

        public static int compareAngle​(Coordinate origin,
                                       Coordinate p,
                                       Coordinate q)
        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 vectors
        p - the endpoint of the vector P
        q - 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