public class Quaternion
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected double |
norm |
|
protected double |
q0 |
|
protected double |
q1 |
|
protected double |
q2 |
|
protected double |
q3 |
|
protected static Space |
space |
|
protected Vector |
vec |
Constructor | Description |
---|---|
Quaternion(double[] p) |
Constructs the Quaternion q = p[0] + p[1]*i + p[2]*j + p[3]*k
|
Quaternion(double a,
double[] b) |
Constructs the Quaternion q = a + b[0]*i + b[1]*j + b[2]*k
|
Quaternion(double a,
double b,
double c,
double d) |
Constructs the Quaternion q = a + b*i + c*j + d*k
|
Quaternion(double a,
Vector b) |
Constructs the Quaternion q = a + b
|
Quaternion(Vector[] basisVec) |
Constructs the Quaternion q for an input basis vector array.
|
Quaternion(Vector axis,
double angle) |
Constructs the unit Quaternion q = cos(angle/2) + axis*sin(angle/2)
|
Quaternion(OrientationFull3D or) |
Constructs the Quaternion q for an input OrientationFull3D with two vectors.
|
Quaternion(Jama.Matrix rotMatrix) |
Constructs the Quaternion q given an input rotation matrix.
|
Modifier and Type | Method | Description |
---|---|---|
Quaternion |
conjugate() |
Returns the complex conjugate of the Quaternion q.
|
double |
getAngle() |
Returns the angle associated with the quaternion
|
Vector |
getAxis() |
Returns the axis associated with the Quaternion.
|
double[] |
getDoubleArray() |
Returns the Quaternion as a double array
|
double |
getNorm() |
Returns the norm of the Quaternion q defined as N = sqrt(q*q)
|
OrientationFull3D |
getOrientation() |
Returns an orientation corresponding to the rotation of cartesian coordinate frame {i,j,k}
by the axis and angle associated with the Quaternion q.
|
double |
getQ0() |
Returns the q0 component of the Quaternion
|
double |
getQ1() |
Returns the q1 component of the Quaternion
|
double |
getQ2() |
Returns the q2 component of the Quaternion
|
double |
getQ3() |
Returns the q3 component of the Quaternion
|
Jama.Matrix |
getRotationMatrix() |
Returns the rotation matrix associated with the Quaternion q as a Jama.Matrix
|
double |
getScalar() |
Returns the scalar part of the Quaternion
|
Vector |
getVector() |
Returns the vector part of the Quaternion as Vector
|
double[] |
getVectorAsDoubleArray() |
Returns the vector associated with the Quaternion as a double array
|
double |
getVectorMagnitude() |
Returns the magnitude of the vector associated with the Quaternion
|
Quaternion |
inverse() |
Returns the inverse of the Quaternion q given by q^-1 = 1/(norm^2) * q*
|
boolean |
isEqualTo(Quaternion p) |
Returns whether the Quaternion is equal to another given Quaternion p
|
boolean |
isIllegal() |
Returns true if even a single component of the quaternion is either infinite or NaN
|
boolean |
isPureQuaternion() |
Returns whether the Quaternion is pure or not
|
boolean |
isUnitQuaternion() |
Returns whether the norm of the Quaternion is 1 or not
|
void |
normalize() |
Normalizes the Quaternion q i.e.
|
void |
PE(Quaternion p) |
Adds the input Quaternion components to its components.
|
Quaternion |
preMultiply(Quaternion preMultiplier) |
Returns the Quaternion r resulting from multiplying the input Quaternion preMultiplier to the current Quaternion q.
|
void |
rotateOrientation(OrientationFull3D or) |
Rotates the input orientation by using the Quaternion rotation operator L(v) = qvq*.
|
void |
rotateVector(Vector v) |
Rotates the input vector by using the Quaternion rotation operator L(v) = qvq*.
|
void |
TE(double a) |
Multiplies all the components of the Quaternion q by the given scalar
|
java.lang.String |
toString() |
Returns the string representation of the Quaternion q
|
protected void |
updateQuaternion() |
First checks if all the components are numbers.
|
protected double q0
protected double q1
protected double q2
protected double q3
protected static final Space space
protected final Vector vec
protected double norm
public Quaternion(double[] p)
public Quaternion(double a, Vector b)
public Quaternion(Vector axis, double angle)
axis
- angle
- public Quaternion(double a, double b, double c, double d)
public Quaternion(double a, double[] b)
public Quaternion(OrientationFull3D or)
or
- public Quaternion(Vector[] basisVec)
basisVec
- public Quaternion(Jama.Matrix rotMatrix)
rotMatrix
- protected void updateQuaternion()
public boolean isIllegal()
public double getQ0()
public double getQ1()
public double getQ2()
public double getQ3()
public double getScalar()
public Vector getVector()
public Vector getAxis()
public double getAngle()
public double[] getVectorAsDoubleArray()
public double getVectorMagnitude()
public double[] getDoubleArray()
public Jama.Matrix getRotationMatrix()
public OrientationFull3D getOrientation()
public boolean isPureQuaternion()
public boolean isEqualTo(Quaternion p)
p
- public boolean isUnitQuaternion()
public void PE(Quaternion p)
p
- public void TE(double a)
a
- public Quaternion preMultiply(Quaternion preMultiplier)
preMultiplier
- public Quaternion conjugate()
public double getNorm()
public void normalize()
public Quaternion inverse()
public void rotateVector(Vector v)
v
- public void rotateOrientation(OrientationFull3D or)
or
- public java.lang.String toString()
toString
in class java.lang.Object