public final class MutablePoint extends Object implements IMutablePoint, ICloneable, Cloneable
This implementation stores the values of the coordinates in double precision floating point members. As a convenience it
implements the ICloneable
interface.
IPoint
Constructor and Description |
---|
MutablePoint()
|
MutablePoint(double x,
double y)
Creates an instance using the given coordinate pair.
|
MutablePoint(IPoint point)
Creates an instance using the given coordinate pair.
|
Modifier and Type | Method and Description |
---|---|
MutablePoint |
clone()
Returns a clone of this instance.
|
boolean |
equals(IPoint other) |
boolean |
equals(Object o)
Implements the equals method by comparing the given object's values.
|
double |
getX()
Gets the x coordinate.
|
double |
getY()
Gets the y coordinate.
|
int |
hashCode()
|
void |
moveBy(PointD delta)
Moves this instance by adding the provided offsets to the coordinates of this point.
|
void |
normalize()
Normalizes this point as if it was a vector.
|
void |
setX(double value)
Sets the x coordinate.
|
void |
setY(double value)
Sets the y coordinate.
|
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, wait
relocate, relocate, relocate
distanceTo, toPointD
public MutablePoint()
public MutablePoint(double x, double y)
x
- The x coordinatey
- The y coordinatepublic MutablePoint(IPoint point)
point
- The coordinate.public final MutablePoint clone()
clone
in interface ICloneable
clone
in class Object
MutablePoint
initialized to the current state of this instance.Object.clone()
public final boolean equals(IPoint other)
public boolean equals(Object o)
Note that PointD
cannot be equal. Only instances of this type and the ones returned by the factory methods of
this type can be equal to each other.
public final double getX()
getX
in interface IMutablePoint
getX
in interface IPoint
setX(double)
public final double getY()
getY
in interface IMutablePoint
getY
in interface IPoint
setY(double)
public int hashCode()
public final void moveBy(PointD delta)
delta
- The offset to add to this point's x coordinatepublic final void normalize()
After this the "length" of this point is 1.0d
if it is treated as a vector.
PointD.getNormalized()
public final void setX(double value)
setX
in interface IMutablePoint
value
- The X to set.getX()
public final void setY(double value)
setY
in interface IMutablePoint
value
- The Y to set.getY()