public class Point2
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static Point2 |
NULL_POINT2
Specific point at (0,0).
|
double |
x
X axis value.
|
double |
y
Y axis value.
|
Constructor and Description |
---|
Point2()
New 2D point at (0,0).
|
Point2(double x,
double y)
New 2D point at (x,y).
|
Point2(Point2 other)
New copy of other.
|
Modifier and Type | Method and Description |
---|---|
void |
copy(Point2 other)
Make this a copy of other.
|
double |
distance(Point2 other)
Distance between this and
other . |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Point2 |
interpolate(Point2 other,
double factor)
Create a new point linear interpolation of this and
other . |
boolean |
isZero()
Are all components to zero?.
|
void |
make(double x,
double y)
New 2D point at (x,y).
|
void |
move(double dx,
double dy)
Move of given vector (dx,dy).
|
void |
move(Point2 p)
Move of given point
p . |
void |
moveTo(double x,
double y)
Move to absolute position (x,y).
|
void |
moveX(double dx)
Move horizontally of dx.
|
void |
moveY(double dy)
Move vertically of dy.
|
void |
scale(double sx,
double sy)
Scale of factor (sx,sy).
|
void |
scale(Point2 s)
Scale by factor s.
|
void |
set(double x,
double y)
Like #moveTo().
|
void |
setX(double x)
Change only abscissa at absolute coordinate x.
|
void |
setY(double y)
Change only ordinate at absolute coordinate y.
|
void |
swap(Point2 other)
Exchange the values of this and other.
|
java.lang.String |
toString() |
public double x
public double y
public static final Point2 NULL_POINT2
public Point2()
public Point2(double x, double y)
public Point2(Point2 other)
public void make(double x, double y)
public boolean isZero()
public Point2 interpolate(Point2 other, double factor)
other
. The
new point is located between this and other
if
factor
is between 0 and 1 (0 yields this point, 1 yields the
other
point).public double distance(Point2 other)
other
.public void copy(Point2 other)
public void set(double x, double y)
public void moveTo(double x, double y)
public void move(double dx, double dy)
public void move(Point2 p)
p
.public void moveX(double dx)
public void moveY(double dy)
public void scale(double sx, double sy)
public void scale(Point2 s)
public void setX(double x)
public void setY(double y)
public void swap(Point2 other)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object