public class MCIndexSnapRounder extends java.lang.Object implements Noder
SegmentString
s.
Implements the Snap Rounding technique described in
papers by Hobby, Guibas & Marimont, and Goodrich et al.
Snap Rounding assumes that all vertices lie on a uniform grid;
hence the precision model of the input must be fixed precision,
and all the input vertices must be rounded to that precision.
This implementation uses a monotone chains and a spatial index to speed up the intersection tests.
This implementation appears to be fully robust using an integer precision model. It will function with non-integer precision models, but the results are not 100% guaranteed to be correctly noded.
Modifier and Type | Field and Description |
---|---|
private LineIntersector |
li |
private java.util.Collection |
nodedSegStrings |
private MCIndexNoder |
noder |
private PrecisionModel |
pm |
private MCIndexPointSnapper |
pointSnapper |
private double |
scaleFactor |
Constructor and Description |
---|
MCIndexSnapRounder(PrecisionModel pm) |
Modifier and Type | Method and Description |
---|---|
private void |
checkCorrectness(java.util.Collection inputSegmentStrings) |
private void |
computeIntersectionSnaps(java.util.Collection snapPts)
Snaps segments to nodes created by segment intersections.
|
void |
computeNodes(java.util.Collection inputSegmentStrings)
Computes the noding for a collection of
SegmentString s. |
void |
computeVertexSnaps(java.util.Collection edges)
Snaps segments to all vertices.
|
private void |
computeVertexSnaps(NodedSegmentString e)
Snaps segments to the vertices of a Segment String.
|
private java.util.List |
findInteriorIntersections(java.util.Collection segStrings,
LineIntersector li)
Computes all interior intersections in the collection of
SegmentString s,
and returns their Coordinate s. |
java.util.Collection |
getNodedSubstrings()
Returns a
Collection of fully noded SegmentString s. |
private void |
snapRound(java.util.Collection segStrings,
LineIntersector li) |
private final PrecisionModel pm
private LineIntersector li
private final double scaleFactor
private MCIndexNoder noder
private MCIndexPointSnapper pointSnapper
private java.util.Collection nodedSegStrings
public MCIndexSnapRounder(PrecisionModel pm)
public java.util.Collection getNodedSubstrings()
Noder
Collection
of fully noded SegmentString
s.
The SegmentStrings have the same context as their parent.getNodedSubstrings
in interface Noder
public void computeNodes(java.util.Collection inputSegmentStrings)
Noder
SegmentString
s.
Some Noders may add all these nodes to the input SegmentStrings;
others may only add some or none at all.computeNodes
in interface Noder
inputSegmentStrings
- a collection of SegmentString
s to nodeprivate void checkCorrectness(java.util.Collection inputSegmentStrings)
private void snapRound(java.util.Collection segStrings, LineIntersector li)
private java.util.List findInteriorIntersections(java.util.Collection segStrings, LineIntersector li)
SegmentString
s,
and returns their Coordinate
s.
Does NOT node the segStrings.private void computeIntersectionSnaps(java.util.Collection snapPts)
public void computeVertexSnaps(java.util.Collection edges)
edges
- the list of segment strings to snap togetherprivate void computeVertexSnaps(NodedSegmentString e)