Package org.spongepowered.api.util
Enum Class Axis
- All Implemented Interfaces:
Serializable
,Comparable<Axis>
,Constable
,Cycleable<Axis>
Represents a three dimensional cartesian axis.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Axis
Gets the closest horizontal direction from the given vector.double
Gets the component of the vector denoted by this axis.Gets the "next"Cycleable
instance to be considered for cycling.Gets the direction of the vector's component denoted by this axis.boolean
isVectorAlongAxis
(Vector3d vector) Returns whether the given vector is along this axis.Gets the Vector3d backing this axis.toVector3dWithDirection
(AxisDirection axisDirection) Gets the Vector3d with the givenAxisDirection
.static Axis
Returns the enum constant of this class with the specified name.static Axis[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
X
-
Y
-
Z
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
closest
Gets the closest horizontal direction from the given vector. If the vector is the 0-Vector, this method returnsX
. If the vector has the same length in a horizontal and vertical direction, a horizontal axis will be returned. If the vector has the same length in x and in z directionX
will be returned.- Parameters:
vector
- The vector to convert to a axis- Returns:
- The closest axis.
-
isVectorAlongAxis
Returns whether the given vector is along this axis.- Parameters:
vector
- The vector to test- Returns:
- True if it is along this axis
-
component
Gets the component of the vector denoted by this axis.- Parameters:
vector3d
- The vector- Returns:
- The value of the component
-
direction
Gets the direction of the vector's component denoted by this axis.- Parameters:
vector3d
- The vector- Returns:
- The direction of the component
-
toVector3d
Gets the Vector3d backing this axis.- Returns:
- the Vector3d
-
toVector3dWithDirection
Gets the Vector3d with the givenAxisDirection
.- Parameters:
axisDirection
- The direction along the axis.- Returns:
- the Vector3d
-
cycleNext
Description copied from interface:Cycleable
Gets the "next"Cycleable
instance to be considered for cycling.
-