Constructor for quaternion objects
Q = Quaternion() Q = Quaternion(Q1) Q = Quaternion([S V1 V2 V3]) Q = Quaternion(S) Q = Quaternion(TH, V) Q = Quaternion(R) Q = Quaternion(T)
Q = Quaternion() is the identitity quaternion 1<0,0,0> representing a null rotation.
Q = Quaternion(Q1) is a copy of the quaternion Q1
Q = Quaternion([S V1 V2 V3]) is a quaternion formed by specifying directly its 4 elements
Q = Quaternion(S) is a quaternion formed from the scalar S and zero vector part: S<0,0,0>
Q = Quaternion(V) is a pure quaternion with the specified vector part: 0<V>
Q = Quaternion(TH, V) is a unit-quaternion corresponding to rotation of TH about the vector V.
Q = Quaternion(R) is a unit-quaternion corresponding to the orthonormal rotation matrix R. If R (3x3xN) is a sequence then Q (Nx1) is a vector of Quaternions corresponding to the elements of R.
Q = Quaternion(T) is a unit-quaternion equivalent to the rotational part of the homogeneous transform T. If T (4x4xN) is a sequence then Q (Nx1) is a vector of Quaternions corresponding to the elements of T.
A quaternion is a compact method of representing a 3D rotation that has computational advantages including speed and numerical robustness. A quaternion has 2 parts, a scalar s, and a vector v and is typically written: q = s <vx, vy, vz>.
A unit-quaternion is one for which s^2+vx^2+vy^2+vz^2 = 1. It can be considered as a rotation by an angle theta about a unit-vector V in space where
q = cos (theta/2) < v sin(theta/2) >
Q = Quaternion(X) is a unit-quaternion equivalent to X which can be any of:
- orthonormal rotation matrix.
- homogeneous transformation matrix (rotation part only).
- rotation angle and vector
inverse of quaterion
norm of quaternion
unitized quaternion
interpolation (slerp) between q and q2, 0<=s<=1
interpolation (slerp) between identity and q, 0<=s<=1
derivative of quaternion with angular velocity w
equivalent 3x3 rotation matrix
equivalent 4x4 homogeneous transform matrix
test for quaternion equality
test for quaternion inequality
elementwise sum of quaternions
elementwise difference of quaternions
quaternion product
rotate vector by quaternion, v is 3x1
elementwise multiplication of quaternion by scalar
q*q2.inv
q to power n (integer only)
real part
vector part
Quaternion objects can be used in vectors and arrays
[1] Animating rotation with quaternion curves, K. Shoemake, in Proceedings of ACM SIGGRAPH, (San Fran cisco), pp. 245-254, 1985.
[2] On homogeneous transforms, quaternions, and computational efficiency, J. Funda, R. Taylor, and R. Paul, IEEE Transactions on Robotics and Automation, vol. 6, pp. 382-388, June 1990.
[3] Robotics, Vision & Control, P. Corke, Springer 2011.