Class SphericalOrientation

java.lang.Object
com.victorvalentim.zividomelive.render.SphericalOrientation

public final class SphericalOrientation extends Object
Gimbal-lock-free spherical orientation controlled by cyclic pitch, yaw, and roll values.

The three values are cyclic control accumulators, not an Euler decomposition of the current attitude. Each value change is converted to the shortest angular delta and composed directly into a unit quaternion in event order. Getter values report the most recently accepted control values.

getQuaternion() returns an immutable value, so callers cannot mutate orientation state through the result.

API stability: Advanced Stable.

Since:
2.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an identity orientation with all control accumulators at zero.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the pitch control accumulator.
    Returns the current immutable unit quaternion.
    float
    Returns the roll control accumulator.
    float
    Returns the yaw control accumulator.
    void
    Restores the identity quaternion and zeroes all control accumulators.
    void
    setPitch(float value)
    Applies a pitch change around the current local X axis.
    void
    setRoll(float value)
    Applies a roll change around the current local Y axis.
    void
    setYaw(float value)
    Applies a yaw change around the current local Z axis.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SphericalOrientation

      public SphericalOrientation()
      Creates an identity orientation with all control accumulators at zero.
  • Method Details

    • setPitch

      public void setPitch(float value)
      Applies a pitch change around the current local X axis.
      Parameters:
      value - pitch control value in radians; non-finite values are ignored
    • setYaw

      public void setYaw(float value)
      Applies a yaw change around the current local Z axis.
      Parameters:
      value - yaw control value in radians; non-finite values are ignored
    • setRoll

      public void setRoll(float value)
      Applies a roll change around the current local Y axis.
      Parameters:
      value - roll control value in radians; non-finite values are ignored
    • getPitch

      public float getPitch()
      Returns the pitch control accumulator.
      Returns:
      pitch control value in radians
    • getYaw

      public float getYaw()
      Returns the yaw control accumulator.
      Returns:
      yaw control value in radians
    • getRoll

      public float getRoll()
      Returns the roll control accumulator.
      Returns:
      roll control value in radians
    • getQuaternion

      public Quaternion getQuaternion()
      Returns the current immutable unit quaternion.
      Returns:
      current spherical orientation
    • reset

      public void reset()
      Restores the identity quaternion and zeroes all control accumulators.