public class Position
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
private static float |
epsilon
An error tolerance.
|
static Position |
NO_POSITION
Holder to indicate no position.
|
float |
x
The x position.
|
float |
y
The y position.
|
Constructor and Description |
---|
Position(double x,
double y)
Creates a new position.
|
Position(float x,
float y)
Creates a new position.
|
Modifier and Type | Method and Description |
---|---|
Position |
clone() |
float |
distanceTo(Position other)
The distance to another position.
|
boolean |
equals(java.lang.Object other)
Checks if this position is the same as an other position.
|
int |
hashCode() |
private float |
round(double value,
int precision)
Rounds a value to a certain precision.
|
java.lang.String |
toString() |
public static final Position NO_POSITION
private static final float epsilon
public final float x
public final float y
public Position(double x, double y)
x
- x position.y
- y position.public Position(float x, float y)
x
- x position.y
- y position.public Position clone()
clone
in class java.lang.Object
public float distanceTo(Position other)
other
- The other position.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- The other position.public int hashCode()
hashCode
in class java.lang.Object
private float round(double value, int precision)
value
- The value.precision
- The precision.public java.lang.String toString()
toString
in class java.lang.Object