Package me.autobot.lib.math.rotation
Class Rotation3d
java.lang.Object
me.autobot.lib.math.rotation.Rotation3d
A 3D rotation in radians.
-
Constructor Summary
ConstructorsConstructorDescriptionRotation3d
(double theta, double phi) Creates a new Rotation3d with the given angles in radians. -
Method Summary
Modifier and TypeMethodDescriptiondouble
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
getPhi()
Gets the xz angle (phi) in radians.double
Get the xz angle in degrees.double
Get the xz angle in radians.double
getTheta()
Returns the xy angle (theta) in radians.double
Get the xy angle in degrees.double
Get the xy angle in radians.inverse()
Get the inverse of the angle.normal()
Returns the normal of the angle (adding 90 degrees to both angles).rotateBy
(Rotation2d other) Creates a new Rotation3d rotated by the given 2d rotation.rotateBy
(Rotation3d other) 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.
-
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
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
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
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
Returns the normal of the angle (adding 90 degrees to both angles).- Returns:
- A new Rotation3d with the normal of the angle.
-
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.
-