public class Position
extends java.lang.Object
Constructor and Description |
---|
Position(float xPos,
float yPos)
Construct and initialize a position.
|
Modifier and Type | Method and Description |
---|---|
static float |
calculateDistance(Position a,
Position b)
Calculates the distance between two positions.
|
boolean |
equals(java.lang.Object o)
Checks if two Positions are the same
|
float |
getX()
Returns the x coordinate.
|
float |
getY()
Returns the y coordinate.
|
java.lang.String |
toString()
Creates a string of the position
|
public Position(float xPos, float yPos)
xPos
- The x coordinate.yPos
- The y coordinate.public float getX()
public float getY()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to compare withpublic static float calculateDistance(Position a, Position b)
a
- the first positionb
- the second positionpublic java.lang.String toString()
toString
in class java.lang.Object