Package snap.geom
Class Point
java.lang.Object
snap.geom.Point
- All Implemented Interfaces:
Cloneable
A class to represent a simple geometric point.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given point to this point.clone()
Standard clone implementation.static boolean
equals
(double x0, double y0, double x1, double y1) Standard equals implementation.boolean
Standard equals implementation.static final double
getAngle
(double x0, double y0, double x1, double y1) Returns the angle to the mouse point.double
getDistance
(double px, double py) Returns the distance from this Point to a specified point.static final double
getDistance
(double x0, double y0, double x1, double y1) Returns the distance from this Point to a specified point.double
getDistance
(Point aPoint) Returns the distance from this Point to a specified point.static final double
getDistanceSquared
(double x0, double y0, double x1, double y1) Returns the distance from this Point to a specified point.int
Returns the rounded x value (as int).int
Returns the rounded y value (as int).final double
getX()
Return point x.final double
getY()
Return point y.void
multiply
(double sx, double sy) Multiplies this point by the given sx and sy.void
offset
(double dx, double dy) Offsets the receiver by the given x and y.final void
Sets the x/y.final void
setX
(double aValue) Set point x.final void
setXY
(double aX, double aY) Sets the x/y.final void
setY
(double aValue) Set point y.void
snap()
Rounds a point to neared integers.void
Subtracts the given point from this point.toString()
Returns a string representation of the receiver in the form "[x y]".void
transformBy
(Transform aTrans) Transforms this point by the given Transform.
-
Field Details
-
x
public double x -
y
public double y
-
-
Constructor Details
-
Point
public Point()Create new point. -
Point
public Point(double aX, double aY) Create new point. -
Point
Create new point.
-
-
Method Details
-
getX
public final double getX()Return point x. -
setX
public final void setX(double aValue) Set point x. -
getY
public final double getY()Return point y. -
setY
public final void setY(double aValue) Set point y. -
setXY
public final void setXY(double aX, double aY) Sets the x/y. -
setPoint
Sets the x/y. -
offset
public void offset(double dx, double dy) Offsets the receiver by the given x and y. -
getRoundX
public int getRoundX()Returns the rounded x value (as int). -
getRoundY
public int getRoundY()Returns the rounded y value (as int). -
add
Adds the given point to this point. -
subtract
Subtracts the given point from this point. -
multiply
public void multiply(double sx, double sy) Multiplies this point by the given sx and sy. -
transformBy
Transforms this point by the given Transform. -
getDistance
Returns the distance from this Point to a specified point. -
getDistance
public double getDistance(double px, double py) Returns the distance from this Point to a specified point. -
snap
public void snap()Rounds a point to neared integers. -
equals
Standard equals implementation. -
clone
Standard clone implementation. -
toString
Returns a string representation of the receiver in the form "[x y]". -
equals
public static boolean equals(double x0, double y0, double x1, double y1) Standard equals implementation. -
getDistance
public static final double getDistance(double x0, double y0, double x1, double y1) Returns the distance from this Point to a specified point. -
getDistanceSquared
public static final double getDistanceSquared(double x0, double y0, double x1, double y1) Returns the distance from this Point to a specified point. -
getAngle
public static final double getAngle(double x0, double y0, double x1, double y1) Returns the angle to the mouse point.
-