select method
Check if a segment of the monotone chain intersects the hot pixel vertex and introduce a snap node if so. Optimized to avoid noding segments which contain the vertex (which otherwise would cause every vertex to be noded).
Implementation
void select(MonotoneChainI mc, int startIndex) {
NodedSegmentString ss = mc.getContext() as NodedSegmentString;
/**
* Check to avoid snapping a hotPixel vertex to the same vertex.
* This method is called for segments which intersects the
* hot pixel,
* so need to check if either end of the segment is equal to the hot pixel
* and if so, do not snap.
*
* Sep 22 2012 - MD - currently do need to snap to every vertex,
* since otherwise the testCollapse1 test in SnapRoundingTest fails.
*/
if (parentEdge == ss) {
// exit if hotpixel is equal to endpoint of target segment
if (startIndex == hotPixelVertexIndex ||
startIndex + 1 == hotPixelVertexIndex) return;
}
// snap and record if a node was created
_isNodeAdded |= hotPixel.addSnappedNode(ss, startIndex);
}