Package me.deecaad.core.utils
Class Quaternion
java.lang.Object
me.deecaad.core.utils.Quaternion
- All Implemented Interfaces:
Cloneable
Deprecated.
Hand-rolled quaternion math.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic QuaternionangleAxis(double angle, org.bukkit.util.Vector axis) Deprecated.Creates a new Quaternion from the given axis and rotation.protected Quaternionclone()Deprecated.doubledot(Quaternion other) Deprecated.booleanDeprecated.static QuaternionfromAxis(org.bukkit.util.Vector right, org.bukkit.util.Vector up, org.bukkit.util.Vector forward) Deprecated.static QuaternionfromEuler(org.bukkit.util.Vector angles) Deprecated.Creates a new Quaternion from the given Euler angles.static QuaternionfromTo(org.bukkit.util.Vector from, org.bukkit.util.Vector to) Deprecated.Creates a quaternion that rotates between the 2 given vectors.org.bukkit.util.VectorDeprecated.Get the Euler Angles (in radians).inthashCode()Deprecated.static Quaternionidentity()Deprecated.Returns the identity quaternion, which is a quaternion with 0 rotation.inverse()Deprecated.booleanisPure()Deprecated.Returnstruewhen the scalar component (w) is zero.booleanisUnit()Deprecated.Returnstruewhen the "length" of the quaternion is zero.static QuaternionlookAt(org.bukkit.util.Vector direction, org.bukkit.util.Vector up) Deprecated.Creates a new quaternion looking in the given direction.multiply(Quaternion other) Deprecated.org.bukkit.util.Vectormultiply(org.bukkit.util.Vector vector) Deprecated.Deprecated.setEulerAngles(org.bukkit.util.Vector angles) Deprecated.Set the Euler Angles (in radians).org.joml.QuaterniondtoJoml()Deprecated.Converts this quaternion to a JOMLQuaterniond.
-
Field Details
-
EPSILON
public static final double EPSILONDeprecated.- See Also:
-
-
Method Details
-
getEulerAngles
public org.bukkit.util.Vector getEulerAngles()Deprecated.Get the Euler Angles (in radians). You can get the yaw, pitch, and roll by accessing the returned vector's x, y, and z components respectively. In general, converting to euler angles from quaternions (and vice versa) is a slow operation, and should be avoided if possible.- Returns:
- The yaw, pitch, and roll, respectively.
- See Also:
-
setEulerAngles
Deprecated.Set the Euler Angles (in radians). angles.x is yaw, angles.y is pitch, and angles.z is roll. In general, converting from euler angles to quaternions (and vice versa) is a slow operation, and should be avoided if possible.- Parameters:
angles- The yaw, pitch, and roll, respectively.- Returns:
- A non-null reference to this (builder pattern)
- See Also:
-
multiply
Deprecated. -
multiply
public org.bukkit.util.Vector multiply(org.bukkit.util.Vector vector) Deprecated. -
dot
Deprecated. -
toJoml
public org.joml.Quaterniond toJoml()Deprecated.Converts this quaternion to a JOMLQuaterniond. Use this to migrate code off of this deprecated class.- Returns:
- A new JOML quaternion with the same
x, y, z, wcomponents.
-
inverse
Deprecated. -
normalize
Deprecated. -
clone
Deprecated. -
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
isUnit
public boolean isUnit()Deprecated.Returnstruewhen the "length" of the quaternion is zero. Generally, you need a unit quaternion in order to do math. Usenormalize()to make this quaternion a unit- Returns:
- true if this is a unit
-
isPure
public boolean isPure()Deprecated.Returnstruewhen the scalar component (w) is zero. Pure quaternions usually hold a vector.- Returns:
- true if this is a pure
-
identity
Deprecated.Returns the identity quaternion, which is a quaternion with 0 rotation.- Returns:
- A copy of the identity
-
lookAt
Deprecated.Creates a new quaternion looking in the given direction.- Parameters:
direction- Normalized direction vector.up- The local upTransform.getUp()- Returns:
- A new quaternion looking in the direction.
-
fromAxis
public static Quaternion fromAxis(org.bukkit.util.Vector right, org.bukkit.util.Vector up, org.bukkit.util.Vector forward) Deprecated. -
fromTo
Deprecated.Creates a quaternion that rotates between the 2 given vectors.- Parameters:
from- From direction.to- To direction.- Returns:
- A new quaternion rotation from -> to.
-
fromEuler
Deprecated.Creates a new Quaternion from the given Euler angles.- Parameters:
angles- The yaw, pitch, and roll stored in x, y, and z respectively.- Returns:
- A new
- See Also:
-
angleAxis
Deprecated.Creates a new Quaternion from the given axis and rotation.- Parameters:
angle- The angle, in radians, to rotate.axis- The normalized axis.- Returns:
- A non-null reference to this (builder pattern).
-
Quaterniond(orQuaternionf) instead. JOML is a well-tested, accurate math library that is already on the classpath. UsetoJoml()to migrate existing instances.