Class Quaternion

java.lang.Object
me.deecaad.core.utils.Quaternion
All Implemented Interfaces:
Cloneable

@Deprecated public class Quaternion extends Object implements Cloneable
Deprecated.
Use JOML's Quaterniond (or Quaternionf) instead. JOML is a well-tested, accurate math library that is already on the classpath. Use toJoml() to migrate existing instances.
Hand-rolled quaternion math.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Quaternion
    angleAxis(double angle, org.bukkit.util.Vector axis)
    Deprecated.
    Creates a new Quaternion from the given axis and rotation.
    protected Quaternion
    Deprecated.
     
    double
    dot(Quaternion other)
    Deprecated.
     
    boolean
    Deprecated.
     
    static Quaternion
    fromAxis(org.bukkit.util.Vector right, org.bukkit.util.Vector up, org.bukkit.util.Vector forward)
    Deprecated.
     
    static Quaternion
    fromEuler(org.bukkit.util.Vector angles)
    Deprecated.
    Creates a new Quaternion from the given Euler angles.
    static Quaternion
    fromTo(org.bukkit.util.Vector from, org.bukkit.util.Vector to)
    Deprecated.
    Creates a quaternion that rotates between the 2 given vectors.
    org.bukkit.util.Vector
    Deprecated.
    Get the Euler Angles (in radians).
    int
    Deprecated.
     
    static Quaternion
    Deprecated.
    Returns the identity quaternion, which is a quaternion with 0 rotation.
    Deprecated.
     
    boolean
    Deprecated.
    Returns true when the scalar component (w) is zero.
    boolean
    Deprecated.
    Returns true when the "length" of the quaternion is zero.
    static Quaternion
    lookAt(org.bukkit.util.Vector direction, org.bukkit.util.Vector up)
    Deprecated.
    Creates a new quaternion looking in the given direction.
    Deprecated.
     
    org.bukkit.util.Vector
    multiply(org.bukkit.util.Vector vector)
    Deprecated.
     
    Deprecated.
     
    setEulerAngles(org.bukkit.util.Vector angles)
    Deprecated.
    Set the Euler Angles (in radians).
    org.joml.Quaterniond
    Deprecated.
    Converts this quaternion to a JOML Quaterniond.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public Quaternion setEulerAngles(org.bukkit.util.Vector angles)
      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

      public Quaternion multiply(Quaternion other)
      Deprecated.
    • multiply

      public org.bukkit.util.Vector multiply(org.bukkit.util.Vector vector)
      Deprecated.
    • dot

      public double dot(Quaternion other)
      Deprecated.
    • toJoml

      public org.joml.Quaterniond toJoml()
      Deprecated.
      Converts this quaternion to a JOML Quaterniond. Use this to migrate code off of this deprecated class.
      Returns:
      A new JOML quaternion with the same x, y, z, w components.
    • inverse

      public Quaternion inverse()
      Deprecated.
    • normalize

      public Quaternion normalize()
      Deprecated.
    • clone

      protected Quaternion clone()
      Deprecated.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Deprecated.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • isUnit

      public boolean isUnit()
      Deprecated.
      Returns true when the "length" of the quaternion is zero. Generally, you need a unit quaternion in order to do math. Use normalize() to make this quaternion a unit
      Returns:
      true if this is a unit
    • isPure

      public boolean isPure()
      Deprecated.
      Returns true when the scalar component (w) is zero. Pure quaternions usually hold a vector.
      Returns:
      true if this is a pure
    • identity

      public static Quaternion identity()
      Deprecated.
      Returns the identity quaternion, which is a quaternion with 0 rotation.
      Returns:
      A copy of the identity
    • lookAt

      public static Quaternion lookAt(org.bukkit.util.Vector direction, org.bukkit.util.Vector up)
      Deprecated.
      Creates a new quaternion looking in the given direction.
      Parameters:
      direction - Normalized direction vector.
      up - The local up Transform.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

      public static Quaternion fromTo(org.bukkit.util.Vector from, org.bukkit.util.Vector to)
      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

      public static Quaternion fromEuler(org.bukkit.util.Vector angles)
      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

      public static Quaternion angleAxis(double angle, org.bukkit.util.Vector axis)
      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).