Class SweepLine


  • public class SweepLine
    extends Object
    Sweep Line algorithm
    Since:
    1.0.5
    Author:
    osbornb
    • Constructor Detail

      • SweepLine

        public SweepLine​(List<LineString> rings)
        Constructor
        Parameters:
        rings - polygon rings
    • Method Detail

      • add

        public Segment add​(Event event)
        Add the event to the sweep line
        Parameters:
        event - event
        Returns:
        added segment
      • find

        public Segment find​(Event event)
        Find the existing event segment
        Parameters:
        event - event
        Returns:
        segment
      • intersect

        public boolean intersect​(Segment segment1,
                                 Segment segment2)
        Determine if the two segments intersect
        Parameters:
        segment1 - segment 1
        segment2 - segment 2
        Returns:
        true if intersection, false if not
      • remove

        public void remove​(Segment segment)
        Remove the segment from the sweep line
        Parameters:
        segment - segment
      • xyOrder

        public static int xyOrder​(Point point1,
                                  Point point2)
        XY order of two points
        Parameters:
        point1 - point 1
        point2 - point 2
        Returns:
        +1 if p1 > p2, -1 if p1 < p2, 0 if equal