|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fi.utu.cs.physics.Tuple2 | +--fi.utu.cs.physics.Point2
A two-element point of double-precision floating point x, y coordinates.
Field Summary | |
static java.util.Comparator |
HORIZONTAL
A comparator for the x coordinates of Point2 objects.
|
static Point2 |
ORIGIN
The origin residing in the coordinates (0.0, 0.0). |
static java.util.Comparator |
VERTICAL
A comparator for the y coordinates of Point2 objects.
|
Constructor Summary | |
Point2(double x,
double y)
Creates a new two-element point with the given coordinates. |
Method Summary | |
void |
add(double x,
double y)
Adds values to the coordinates. |
protected void |
add(Point2 other)
Adds the coordinates of other to the coordinates. |
double |
getX()
Returns the x coordinate. |
double |
getY()
Returns the y coordinate. |
void |
set(double x,
double y)
Sets the coordinates. |
void |
set(Point2 other)
Sets the coordinates to the same values as in other . |
void |
setX(double x)
Sets the x coordinate to x . |
void |
setY(double y)
Sets the y coordinate to y . |
void |
transfer(Vector2 v)
Transfers the coordinates according to the vector v .
|
Vector2 |
vectorFrom(Point2 source)
Creates and returns a vector that corresponds the transfer from the point source to this point. |
Vector2 |
vectorTo(Point2 target)
Creates and returns a vector that corresponds the transfer from this point to the point target . |
Methods inherited from class fi.utu.cs.physics.Tuple2 |
add, clone, equals, getFirstElement, getSecondElement, hashCode, max, min, negate, negateFirstElement, negateSecondElement, set, setFirstElement, setSecondElement, swap, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Point2 ORIGIN
public static final java.util.Comparator HORIZONTAL
Point2
objects.
The compare
method returns a negative integer, zero,
or a positive integer as the x coordinate of the first argument is
less than, equal to, or greater than the x coordinate of the second.public static final java.util.Comparator VERTICAL
Point2
objects.
The compare
method returns a negative integer, zero,
or a positive integer as the y coordinate of the first argument is
less than, equal to, or greater than the y coordinate of the second.Constructor Detail |
public Point2(double x, double y)
Method Detail |
public double getX()
public double getY()
public void setX(double x)
x
.public void setY(double y)
y
.public void set(double x, double y)
set
in class Tuple2
x
- The value of the x coordinate.y
- The value of the y coordinate.set(Point2)
public void set(Point2 other)
other
.public void add(double x, double y)
add
in class Tuple2
x
- The value added to the x coordinate.y
- The value added to the y coordinate.add(Point2)
protected void add(Point2 other)
other
to the coordinates.public void transfer(Vector2 v)
v
.
After the transfer, getX() = this.getX() + v.getDeltaX()
and
getY() = this.getY() + v.getDeltaY()
.public Vector2 vectorTo(Point2 target)
target
. In the new
vector, getDeltaX() = target.getX() - this.getX()
and
getDeltaY() = target.getY() - this.getY()
.vectorFrom(Point2)
,
Vector2.Vector2(Point2,Point2)
public Vector2 vectorFrom(Point2 source)
source
to this point. In the new
vector, getDeltaX() = this.getX() - source.getX()
and
getDeltaY() = this.getY() - source.getY()
.vectorTo(Point2)
,
Vector2.Vector2(Point2,Point2)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |