br_quat
The x, y and z components of the quaternion hold the elements of this vector scaled to a length equal to the sine of half the angle of rotation. The w component holds the cosine of half the angle. The magnitude of a unit quaternion is of course 1 (w2+x2+y2+z2=1).
The quaternion is written thus:
NB Do not confuse the quaternion with 3D vectors or homogenous co-ordinates, i.e. br_quat
311
br_vector4
365
have no relationship.
typedef
quat.h
for precise declaration and ordering)
br_scalar w Real component
br_scalar x `i' component (vector, x axis component)
br_scalar y `j' component (vector, y axis component)
br_scalar z `k' component (vector, z axis component)
BrEulerToQuat()
120
, BrMatrix34ToQuat()
204
, BrMatrix4ToQuat()
222
.
br_transform
339
.
A pointer to the destination quaternion (may be same as either source).
A pointer to the left hand source quaternion.
A pointer to the right hand source quaternion.
The destination quaternion pointer is returned as supplied for convenience.
A pointer to the destination quaternion (can be same as source).
A pointer to the source quaternion.
The destination quaternion pointer is returned as supplied for convenience.
A pointer to the destination quaternion (can be same as either source).
A pointer to the starting quaternion (equivalent to result with t=0).
A pointer to the finishing quaternion (equivalent to result with t=1).
Interpolation parameter in the range [0,1].
Number of extra spins in the interpolated path.
A special value of zero causes interpolation along the shortest path.
A special value of -1 causes interpolation along the longest path.
The destination quaternion pointer is returned as supplied for convenience.
Members
Real component of quaternion. Represents the cosine of half the rotation about the (i,j,k) vector component of the quaternion.br_scalar w
First imaginary component of quaternion. Represents the x axis component of the vector about which the rotation occurs.br_scalar x
Second imaginary component of quaternion. Represents the y axis component of the vector about which the rotation occurs.br_scalar y
Third imaginary component of quaternion. Represents the z axis component of the vector about which the rotation occurs.br_scalar z
Arithmetic
Description:
Multiply two quaternions.BrQuatMul()
br_quat* BrQuatMul(br_quat* q, const br_quat* l, const br_quat* r)
br_quat * q
const br_quat * l
const br_quat * r
br_quat *
Description:
Obtain the inverse of a unit quaternion. This is effectively the rotation reversed (about the same vector component).BrQuatInvert()
br_quat* BrQuatInvert(br_quat* q, const br_quat* qq)
br_quat * q
const br_quat * qq
br_quat *
Description:
The `Slerp' operation (spherical, linear interpolation) interpolates linearly between two quaternions along the most direct path between the two orientations.BrQuatSlerp()
br_quat* BrQuatSlerp(br_quat* q, const br_quat* l, const br_quat* r, br_scalar t, br_int_16 spins)
br_quat * q
const br_quat * l
const br_quat * l
br_scalar t
br_int_16
l
and r
corresponding to position t
along the interpolated path between them.br_quat *
Conversion
From Eulers and Matrices
See BrEulerToQuat()
120,
BrMatrix34ToQuat()
204BrMatrix4ToQuat()
222 To Eulers and Matrices
See BrQuatToEuler()
314,
BrQuatToMatrix34()
314, and
BrQuatToMatrix4()
315
as described below.
Also see BrTransformToTransform()
343.
A pointer to the destination Euler angle set to receive the conversion.
A pointer to the source unit quaternion.
Returns
A pointer to the destination matrix to receive the conversion.
A pointer to the source unit quaternion.
Returns
A pointer to the destination matrix to receive the conversion.
A pointer to the source unit quaternion.
Returns
A pointer to the destination quaternion (may be same as source).
A pointer to the source quaternion.
All other initialisation should be member-wise or by using structure assignment.
Description:
Convert a unit quaternion to an Euler angle set, that would have the same transformational effect.BrQuatToEuler()
br_euler* BrQuatToEuler(br_euler* euler, const br_quat* q)
br_euler * euler
const br_quat * q
br_euler *
euler
for convenience.
Description:
Convert a unit quaternion to a 3D affine matrix, that would have the same transformational effect.BrQuatToMatrix34()
br_matrix34* BrQuatToMatrix34(br_matrix34* mat, const br_quat* q)
br_matrix34 * mat
const br_quat * q
br_matrix34 *
mat
for convenience.mat
is equivalent to the following:
Description:
Convert a unit quaternion to a 3D affine matrix, that would have the same transformational effect.BrQuatToMatrix4()
br_matrix4* BrQuatToMatrix4(br_matrix4* mat, const br_quat* q)
br_matrix4 * mat
const br_quat * q
br_matrix4 *
mat
for convenience.BrQuatToMatrix34()
314.
Copy/Assign
Use structure assignment to copy quaternions. Access & Maintenance
Members may be freely accessed. Maintenance is only required for unit quaternions that have been modified.
Description:
Normalise a quaternion.BrQuatNormalise()
br_quat* BrQuatNormalise(br_quat* q, const br_quat* qq)
br_quat * q
const br_quat * qq
Initialisation
The following macro may be used as a static initialiser. Note the order in which the components are specified.
BR_QUAT(x,y,z,w)
Macro expands to {
BR_SCALAR
(x),
BR_SCALAR
(y),
BR_SCALAR
(z),
BR_SCALAR
(w)}
.
Generated with CERN WebMaker