Package edu.wpi.first.math.geometry
Class Quaternion
java.lang.Object
edu.wpi.first.math.geometry.Quaternion
public class Quaternion extends Object
-
Constructor Summary
Constructors Constructor Description Quaternion()
Constructs a quaternion with a default angle of 0 degrees.Quaternion(double w, double x, double y, double z)
Constructs a quaternion with the given components. -
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
Checks equality between this Quaternion and another object.double
getW()
Returns W component of the quaternion.double
getX()
Returns X component of the quaternion.double
getY()
Returns Y component of the quaternion.double
getZ()
Returns Z component of the quaternion.int
hashCode()
Quaternion
inverse()
Returns the inverse of the quaternion.Quaternion
normalize()
Normalizes the quaternion.Quaternion
times(Quaternion other)
Multiply with another quaternion.Vector<N3>
toRotationVector()
Returns the rotation vector representation of this quaternion.String
toString()
-
Constructor Details
-
Quaternion
public Quaternion()Constructs a quaternion with a default angle of 0 degrees. -
Quaternion
Constructs a quaternion with the given components.- Parameters:
w
- W component of the quaternion.x
- X component of the quaternion.y
- Y component of the quaternion.z
- Z component of the quaternion.
-
-
Method Details
-
times
Multiply with another quaternion.- Parameters:
other
- The other quaternion.- Returns:
- The quaternion product.
-
toString
-
equals
Checks equality between this Quaternion and another object. -
hashCode
-
inverse
Returns the inverse of the quaternion.- Returns:
- The inverse quaternion.
-
normalize
Normalizes the quaternion.- Returns:
- The normalized quaternion.
-
getW
Returns W component of the quaternion.- Returns:
- W component of the quaternion.
-
getX
Returns X component of the quaternion.- Returns:
- X component of the quaternion.
-
getY
Returns Y component of the quaternion.- Returns:
- Y component of the quaternion.
-
getZ
Returns Z component of the quaternion.- Returns:
- Z component of the quaternion.
-
toRotationVector
Returns the rotation vector representation of this quaternion.This is also the log operator of SO(3).
- Returns:
- The rotation vector representation of this quaternion.
-