Class Rotation

java.lang.Object
net.apartium.cocoabeans.space.Rotation

@AvailableSince("0.0.30") public class Rotation extends Object
Rotation is 3D space
  • Constructor Details

    • Rotation

      public Rotation(float yaw, float pitch)
      Create a new rotation
      Parameters:
      yaw - yaw
      pitch - pitch
    • Rotation

      public Rotation(Rotation other)
      Create a new rotation
      Parameters:
      other - create copy of other
  • Method Details

    • getYaw

      public float getYaw()
      Returns the yaw
      Returns:
      yaw
    • setYaw

      public Rotation setYaw(float yaw)
      Sets the yaw
      Parameters:
      yaw - new yaw
      Returns:
      this
    • getPitch

      public float getPitch()
      Returns the pitch
      Returns:
      pitch
    • setPitch

      public Rotation setPitch(float pitch)
      Sets the pitch
      Parameters:
      pitch - new pitch
      Returns:
      this
    • add

      public Rotation add(Rotation other)
      Add another rotation to this rotation
      Parameters:
      other - rotation to add
      Returns:
      this
    • subtract

      public Rotation subtract(Rotation other)
      Subtract another rotation from this rotation
      Parameters:
      other - rotation to subtract
      Returns:
      this
    • multiply

      public Rotation multiply(double scalar)
      Multiply this rotation by a scalar
      Parameters:
      scalar - value to multiply by
      Returns:
      this
    • normalize

      public Rotation normalize()
      Normalize the rotation angles to be within standard ranges Yaw: [0, 360), Pitch: [-90, 90]
      Returns:
      this
    • dot

      public double dot(Rotation other)
      Calculate the dot product of this rotation with another
      Parameters:
      other - rotation to calculate dot product with
      Returns:
      dot product
    • magnitude

      public double magnitude()
      Calculate the magnitude (length) of this rotation vector
      Returns:
      magnitude
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object