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 TypeMethodDescriptionbooleanstatic @NotNull Coordinate3DfromString(String point) Parses a 3D Coordinate from a string.Gets the dimension of the Coordinate.doublegetDistance(Coordinate coordinate) Gets the distance between two Coordinates.doubleGets the magnitude of the Coordinate.doublegetX()Gets the X Value of the Coordinate.doublegetY()Gets the Y Value of the Coordinate.doublegetZ()Gets the Z Value of the Coordinate.inthashCode()voidsetX(double x) Sets the X Value of the Coordinate.voidsetY(double y) Sets the Y Value of the Coordinate.voidsetZ(double z) Sets the Z Value of the Coordinate.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:CoordinateGets the distance between two Coordinates.- Specified by:
getDistancein interfaceCoordinate- Parameters:
coordinate- Other Coordinate- Returns:
- Distance between Coordinates
-
getMagnitude
public double getMagnitude()Description copied from interface:CoordinateGets the magnitude of the Coordinate.- Specified by:
getMagnitudein interfaceCoordinate- Returns:
- Coordinate Magnitude
-
getDimension
Description copied from interface:CoordinateGets the dimension of the Coordinate.- Specified by:
getDimensionin interfaceCoordinate- Returns:
- Coordinate Dimension
-
equals
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCoordinate- Overrides:
hashCodein classObject
-
toString
- Specified by:
toStringin interfaceCoordinate- Overrides:
toStringin classObject
-
fromString
Parses a 3D Coordinate from a string.- Parameters:
point- String- Returns:
- 3D Coordinate
-