public class SnapConstraint extends java.lang.Object implements PointConstraint
| Red (johnr) |
| Red (eal) |
| Constructor and Description |
|---|
SnapConstraint()
Construct a new instance of a snap constraint.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
constrain(double[] point)
Modify the specified point to snap to grid using the local
resolution.
|
double[] |
constrain(double x,
double y)
Modify the specified point to snap to grid using the local
resolution.
|
void |
constrain(java.awt.geom.Point2D point)
Modify the specified point to snap to grid using the local
resolution.
|
static double[] |
constrainPoint(double[] point)
Modify the specified point to snap to grid using the global
default resolution.
|
static double[] |
constrainPoint(double x,
double y)
Modify the specified point to snap to grid using the global
default resolution.
|
static java.awt.geom.Point2D |
constrainPoint(java.awt.geom.Point2D point)
Modify the specified point to snap to grid using the global
default resolution.
|
static double |
getDefaultResolution()
Return the default resolution.
|
double |
getResolution()
Return the resolution for this instance.
|
void |
setResolution(double resolution)
Set the resolution for this instance.
|
boolean |
snapped()
Return true to indicate that this does snap to grid.
|
public SnapConstraint()
public void constrain(java.awt.geom.Point2D point)
constrain in interface PointConstraintpoint - The point to modify.public double[] constrain(double[] point)
point - The point to modify (a dimension 2 array).public double[] constrain(double x,
double y)
x - The x dimension of the point to modify.y - The y dimension of the point to modify.public static java.awt.geom.Point2D constrainPoint(java.awt.geom.Point2D point)
point - The point to modify.public static double[] constrainPoint(double[] point)
point - The point to modify (a dimension 2 array).public static double[] constrainPoint(double x,
double y)
x - The x dimension of the point to modify.y - The y dimension of the point to modify.public static double getDefaultResolution()
public double getResolution()
setResolution(double)public boolean snapped()
snapped in interface PointConstraintpublic void setResolution(double resolution)
resolution - The new resolution.getResolution()