Class HotPixel

Hierarchy: Object , HotPixel
public class HotPixel
Implements a "hot pixel" as used in the Snap Rounding algorithm. A hot pixel contains the interior of the tolerance square and the boundary minus the top and right segments.

The hot pixel operations are all computed in the integer domain to avoid rounding problems.

Other

  • version: 1.7
public HotPixel(Coordinate pt, double scaleFactor, LineIntersector li)
Creates a new hot pixel, using a given scale factor. The scale factor must be strictly positive (non-zero).
Parameters:
pt - pt the coordinate at the centre of the pixel
scaleFactor - scaleFactor the scaleFactor determining the pixel size. Must be > 0
li - li the intersector to use for testing intersection with line segments
public Coordinate getCoordinate()
Gets the coordinate this hot pixel is based at.
Returns:
the coordinate of the pixel
public Envelope getSafeEnvelope()
Returns a "safe" envelope that is guaranteed to contain the hot pixel. The envelope returned will be larger than the exact envelope of the pixel.
Returns:
an envelope which contains the hot pixel
public boolean intersects(Coordinate p0, Coordinate p1)
Tests whether the line segment (p0-p1) intersects this hot pixel.
Parameters:
p0 - p0 the first coordinate of the line segment to test
p1 - p1 the second coordinate of the line segment to test
Returns:
true if the line segment intersects this hot pixel
public boolean addSnappedNode(NodedSegmentString segStr, int segIndex)
Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixel
Parameters:
segStr - segStr
segIndex - segIndex
Returns:
true if a node was added to the segment