public class Coordinates
extends java.awt.geom.Point2D.Float
Constructor and Description |
---|
Coordinates() |
Coordinates(Coordinates coordinates)
Initializes this coordinate to the value of the passed-in
coordinate.
|
Coordinates(double x,
double y) |
Modifier and Type | Method and Description |
---|---|
void |
add(double x,
double y)
Increases the x and y values of this
scalar by (x, y).
|
void |
addX(double d)
Increases the x value by d.
|
void |
addY(double d)
Increases the y value by d.
|
double |
distance(Coordinates o)
Computes the euclidean distance between two coordinates
|
Coordinates |
midpoint(Coordinates o)
Computes the midpoint between the two coordinates
|
void |
mult(double x,
double y)
Multiplies a coordinate by scalar x and y values.
|
void |
multX(double d)
Multiplies the X coordinate by a scalar value.
|
void |
multY(double d)
Multiplies the Y coordinate by a scalar value.
|
void |
setX(double d)
Sets the x value to be d;
|
void |
setY(double d)
Sets the y value to be d;
|
getX, getY, setLocation, setLocation, toString
public Coordinates()
public Coordinates(double x, double y)
public Coordinates(Coordinates coordinates)
coordinates
- public void setX(double d)
d
- public void setY(double d)
d
- public void add(double x, double y)
x
- y
- public void addX(double d)
d
- public void addY(double d)
d
- public void mult(double x, double y)
x
- A scalar to multiple x byy
- A scalar to multiply y bypublic void multX(double d)
For example, (3, 10) x-scaled by 2 returns (6, 10).
d
- the scalar value by which x will be multipliedpublic void multY(double d)
For example, (3, 10) y-scaled by 2 returns (3, 20).
d
- the scalar value by which y will be multipliedpublic double distance(Coordinates o)
o
- another coordinatespublic Coordinates midpoint(Coordinates o)
o
- another coordinates