Class Rotation3d

java.lang.Object
me.autobot.lib.math.rotation.Rotation3d

public class Rotation3d extends Object
A 3D rotation in radians.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Rotation3d(double theta, double phi)
    Creates a new Rotation3d with the given angles in radians.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    cos()
    Returns the cosine multiplied of the angles.
    static Rotation3d
    fromDegrees(double theta, double phi)
    Returns a new Rotation3d with the given angles in radians.
    double
    Gets the xz angle (phi) in radians.
    double
    Get the xz angle in degrees.
    double
    Get the xz angle in radians.
    double
    Returns the xy angle (theta) in radians.
    double
    Get the xy angle in degrees.
    double
    Get the xy angle in radians.
    Get the inverse of the angle.
    Returns the normal of the angle (adding 90 degrees to both angles).
    Creates a new Rotation3d rotated by the given 2d rotation.
    Rotate the angle by the given 3d angle.
    void
    setPhi(double phi)
    Sets the xz angle (phi) in radians.
    void
    setTheta(double theta)
    Sets the xy angle (theta) in radians.
    double
    sin()
    Returns the sine multiplied of the angles.
    double
    tan()
    Returns the tangent multiplied of the angles.

    Methods inherited from class java.lang.Object

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

    • Rotation3d

      public Rotation3d(double theta, double phi)
      Creates a new Rotation3d with the given angles in radians.
      Parameters:
      theta - The angle in radians. This is the angle in the xy plane.
      phi - The angle in radians. This is the angle in the xz plane.
  • Method Details

    • fromDegrees

      public static Rotation3d fromDegrees(double theta, double phi)
      Returns a new Rotation3d with the given angles in radians.
      Parameters:
      theta - The angle in radians. This is the angle in the xy plane.
      phi - The angle in radians. This is the angle in the xz plane.
      Returns:
      A new Rotation3d with the given angles in radians.
    • getTheta

      public double getTheta()
      Returns the xy angle (theta) in radians.
      Returns:
      The xy angle in radians.
    • setTheta

      public void setTheta(double theta)
      Sets the xy angle (theta) in radians.
      Parameters:
      theta - The xy angle in radians.
    • getPhi

      public double getPhi()
      Gets the xz angle (phi) in radians.
      Returns:
      The xz angle in radians.
    • setPhi

      public void setPhi(double phi)
      Sets the xz angle (phi) in radians.
      Parameters:
      phi - The xz angle in radians.
    • rotateBy

      public Rotation3d rotateBy(Rotation2d other)
      Creates a new Rotation3d rotated by the given 2d rotation.
      Parameters:
      other - The 2d rotation to rotate by.
      Returns:
      A new Rotation3d with the angle rotated by the given 2d angle.
    • rotateBy

      public Rotation3d rotateBy(Rotation3d other)
      Rotate the angle by the given 3d angle.
      Parameters:
      other - The angle to rotate by.
      Returns:
      A new Rotation3d with the angle rotated by the given angle.
    • normal

      public Rotation3d normal()
      Returns the normal of the angle (adding 90 degrees to both angles).
      Returns:
      A new Rotation3d with the normal of the angle.
    • inverse

      public Rotation3d inverse()
      Get the inverse of the angle.
      Returns:
      A new Rotation3d with the inverse of the angle.
    • cos

      public double cos()
      Returns the cosine multiplied of the angles.
      Returns:
      The cosine of the angles.
    • sin

      public double sin()
      Returns the sine multiplied of the angles.
      Returns:
      The sine of the angle.
    • tan

      public double tan()
      Returns the tangent multiplied of the angles.
      Returns:
      The tangent of the angle.
    • getThetaRadians

      public double getThetaRadians()
      Get the xy angle in radians.
      Returns:
      The xy angle in radians.
    • getPhiRadians

      public double getPhiRadians()
      Get the xz angle in radians.
      Returns:
      The xz angle in radians.
    • getThetaDegrees

      public double getThetaDegrees()
      Get the xy angle in degrees.
      Returns:
      The xy angle in degrees.
    • getPhiDegrees

      public double getPhiDegrees()
      Get the xz angle in degrees.
      Returns:
      The xz angle in degrees.