Package xyz.calcugames.levelz.coord
Class Coordinate3D
java.lang.Object
xyz.calcugames.levelz.coord.Coordinate3D
- All Implemented Interfaces:
Comparable<Coordinate>
,Coordinate
Represents a 3-Dimensional Coordinate.
-
Constructor Summary
ConstructorsConstructorDescriptionCoordinate3D
(double[] xyz) Constructs a 3D Coordinate.Coordinate3D
(double x, double y, double z) Constructs a 3D Coordinate.Coordinate3D
(float[] xyz) Constructs a 3D Coordinate.Coordinate3D
(float x, float y, float z) Constructs a 3D Coordinate.Coordinate3D
(int[] xyz) Constructs a 3D Coordinate.Coordinate3D
(int x, int y, int z) Constructs a 3D Coordinate. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static @NotNull Coordinate3D
fromString
(String point) Parses a 3D Coordinate from a string.Gets the dimension of the Coordinate.double
getDistance
(Coordinate coordinate) Gets the distance between two Coordinates.double
Gets the magnitude of the Coordinate.double
getX()
Gets the X Value of the Coordinate.double
getY()
Gets the Y Value of the Coordinate.double
getZ()
Gets the Z Value of the Coordinate.int
hashCode()
void
setX
(double x) Sets the X Value of the Coordinate.void
setY
(double y) Sets the Y Value of the Coordinate.void
setZ
(double z) Sets the Z Value of the Coordinate.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface xyz.calcugames.levelz.coord.Coordinate
compareTo
-
Constructor Details
-
Coordinate3D
public Coordinate3D(int x, int y, int z) Constructs a 3D Coordinate.- Parameters:
x
- X Valuey
- Y Valuez
- Z Value
-
Coordinate3D
public Coordinate3D(int[] xyz) Constructs a 3D Coordinate.- Parameters:
xyz
- Array of X, Y, and Z Values
-
Coordinate3D
public Coordinate3D(float x, float y, float z) Constructs a 3D Coordinate.- Parameters:
x
- X Valuey
- Y Valuez
- Z Value
-
Coordinate3D
public Coordinate3D(float[] xyz) Constructs a 3D Coordinate.- Parameters:
xyz
- Array of X, Y, and Z Values
-
Coordinate3D
public Coordinate3D(double x, double y, double z) Constructs a 3D Coordinate.- Parameters:
x
- X Valuey
- Y Valuez
- Z Value
-
Coordinate3D
public Coordinate3D(double[] xyz) Constructs a 3D Coordinate.- Parameters:
xyz
- Array of X, Y, and Z Values
-
-
Method Details
-
getX
public double getX()Gets the X Value of the Coordinate.- Returns:
- X Value
-
setX
public void setX(double x) Sets the X Value of the Coordinate.- Parameters:
x
- X Value
-
getY
public double getY()Gets the Y Value of the Coordinate.- Returns:
- Y Value
-
setY
public void setY(double y) Sets the Y Value of the Coordinate.- Parameters:
y
- Y Value
-
getZ
public double getZ()Gets the Z Value of the Coordinate.- Returns:
- Z Value
-
setZ
public void setZ(double z) Sets the Z Value of the Coordinate.- Parameters:
z
- Z Value
-
getDistance
Description copied from interface:Coordinate
Gets the distance between two Coordinates.- Specified by:
getDistance
in interfaceCoordinate
- Parameters:
coordinate
- Other Coordinate- Returns:
- Distance between Coordinates
-
getMagnitude
public double getMagnitude()Description copied from interface:Coordinate
Gets the magnitude of the Coordinate.- Specified by:
getMagnitude
in interfaceCoordinate
- Returns:
- Coordinate Magnitude
-
getDimension
Description copied from interface:Coordinate
Gets the dimension of the Coordinate.- Specified by:
getDimension
in interfaceCoordinate
- Returns:
- Coordinate Dimension
-
equals
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCoordinate
- Overrides:
hashCode
in classObject
-
toString
- Specified by:
toString
in interfaceCoordinate
- Overrides:
toString
in classObject
-
fromString
Parses a 3D Coordinate from a string.- Parameters:
point
- String- Returns:
- 3D Coordinate
-