public class HotPixel extends Object
The hot pixel operations are all computed in the integer domain to avoid rounding problems.
Hot Pixels support being marked as nodes. This is used to prevent introducing nodes at line vertices which do not have other lines snapped to them.
Constructor and Description |
---|
HotPixel(Coordinate pt,
double scaleFactor)
Creates a new hot pixel centered on a rounded point, using a given scale factor.
|
Modifier and Type | Method and Description |
---|---|
Coordinate |
getCoordinate()
Gets the coordinate this hot pixel is based at.
|
double |
getScaleFactor()
Gets the scale factor for the precision grid for this pixel.
|
double |
getWidth()
Gets the width of the hot pixel in the original coordinate system.
|
boolean |
intersects(Coordinate p)
Tests whether a coordinate lies in (intersects) this hot pixel.
|
boolean |
intersects(Coordinate p0,
Coordinate p1)
Tests whether the line segment (p0-p1)
intersects this hot pixel.
|
boolean |
isNode()
Tests whether this pixel has been marked as a node.
|
void |
setToNode()
Sets this pixel to be a node.
|
String |
toString() |
public HotPixel(Coordinate pt, double scaleFactor)
pt
- the coordinate at the centre of the pixel (already rounded)scaleFactor
- the scaleFactor determining the pixel size. Must be > 0public Coordinate getCoordinate()
public double getScaleFactor()
public double getWidth()
public boolean isNode()
public void setToNode()
public boolean intersects(Coordinate p)
p
- the coordinate to testpublic boolean intersects(Coordinate p0, Coordinate p1)
p0
- the first coordinate of the line segment to testp1
- the second coordinate of the line segment to testCopyright © 2022. All rights reserved.