﻿Quaternion Methods  # Quaternion Methods

The Quaternion type exposes the following members. Methods
NameDescription  CrossProduct
Computes the vector cross product of p and q = (0,x,y,z),

where (x,y,z) = CrossProduct(p.Vector,q.Vector).

This is not the same as the quaternion product p*q.  Distance
Returns the distance or norm of the difference between two quaternions. DistanceTo
Computes the distance or norm of the difference between this and another quaternion. EpsilonEquals
Check that all values in other are within epsilon of the values in this Equals(Object)
Determines whether an object is a quaternion and has the same value of this quaternion.
(Overrides ValueTypeEquals(Object).) Equals(Quaternion)
Determines whether this quaternion has the same value of another quaternion. GetHashCode
Gets a non-unique but repeatable hashing code for this quaternion.
(Overrides ValueTypeGetHashCode.) GetRotation(Plane)
Returns the frame created by applying the quaternion's rotation to the canonical world frame (1,0,0),(0,1,0),(0,0,1). GetRotation(Transform)
Returns a transformation matrix that performs the rotation defined by the quaternion. The transformation returned by this method has the property that xform * V = q.Rotate(V). If the quaternion is not unitized, the rotation of its unitized form is returned. GetRotation(Double, Vector3d)
Returns the rotation defined by the quaternion. GetType
Gets the Type of the current instance.
(Inherited from Object.) Invert
Modifies this quaternion to become

(a/L2, -b/L2, -c/L2, -d/L2),

where L2 = length squared = (a*a + b*b + c*c + d*d).

This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0). MatrixForm
Returns 4x4 real valued matrix form of the quaternion a b c d -b a -d c -c d a -b -d -c b a which has the same arithmetic properties as the quaternion.  Product
The quaternion product of p and q. This is the same value as p*q. Rotate
Rotates a 3d vector. This operation is also called conjugation, because the result is the same as (q.Conjugate()*(0,x,y,x)*q/q.LengthSquared).Vector.  Rotation(Double, Vector3d)
Returns the unit quaternion cos(angle/2), sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)*z where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis.  Rotation(Plane, Plane)
Returns the unit quaternion that represents the rotation that maps plane0.xaxis to plane1.xaxis, plane0.yaxis to plane1.yaxis, and plane0.zaxis to plane1.zaxis. Set
Sets all coefficients of the quaternion. SetRotation(Double, Vector3d)
Sets the quaternion to cos(angle/2), sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)*z where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis. SetRotation(Plane, Plane)
Sets the quaternion to the unit quaternion which rotates plane0.xaxis to plane1.xaxis, plane0.yaxis to plane1.yaxis, and plane0.zaxis to plane1.zaxis. ToString
Returns a string representation of this Quaternion.
(Overrides ValueTypeToString.) Unitize
Scales the quaternion's coordinates so that a*a + b*b + c*c + d*d = 1.
Top See Also