com.vividsolutions.jts.geomgraph.index

Class SimpleMCSweepLineIntersector


public class SimpleMCSweepLineIntersector
extends EdgeSetIntersector

Finds all intersections in one or two sets of edges, using an x-axis sweepline algorithm in conjunction with Monotone Chains. While still O(n^2) in the worst case, this algorithm drastically improves the average-case time. The use of MonotoneChains as the items in the index seems to offer an improvement in performance over a sweep-line alone.
Version:
1.6

Constructor Summary

SimpleMCSweepLineIntersector()
A SimpleMCSweepLineIntersector creates monotone chains from the edges and compares them using a simple sweep-line along the x-axis.

Method Summary

void
computeIntersections(List edges0, List edges1, SegmentIntersector si)
Computes all mutual intersections between two sets of edges.
void
computeIntersections(List edges, SegmentIntersector si, boolean testAllSegments)
Computes all self-intersections between edges in a set of edges, allowing client to choose whether self-intersections are computed.

Methods inherited from class com.vividsolutions.jts.geomgraph.index.EdgeSetIntersector

computeIntersections, computeIntersections

Constructor Details

SimpleMCSweepLineIntersector

public SimpleMCSweepLineIntersector()
A SimpleMCSweepLineIntersector creates monotone chains from the edges and compares them using a simple sweep-line along the x-axis.

Method Details

computeIntersections

public void computeIntersections(List edges0,
                                 List edges1,
                                 SegmentIntersector si)
Computes all mutual intersections between two sets of edges.
Overrides:
computeIntersections in interface EdgeSetIntersector

computeIntersections

public void computeIntersections(List edges,
                                 SegmentIntersector si,
                                 boolean testAllSegments)
Computes all self-intersections between edges in a set of edges, allowing client to choose whether self-intersections are computed.
Overrides:
computeIntersections in interface EdgeSetIntersector
Parameters:
edges - a list of edges to test for intersections
si - the SegmentIntersector to use
testAllSegments - true if self-intersections are to be tested as well