|
resonance 1.0.1
|

Go to the source code of this file.
Classes | |
| class | Quat |
| Rotation quaternion, stored as the vector part followed by the scalar part. More... | |
Namespaces | |
| namespace | Rnd |
| The rendering engine. | |
Functions | |
| void | Rnd::MakeAxisAngle (const Quat &quat, float *pAxis, float *pflAngle) |
| Recover the axis and angle of a rotation quaternion. | |
| Quat | EulerAnglesToQuat (const float *pAngles) |
| Build a rotation quaternion from three Euler angles. | |
| void | QuatMultiply (const Quat &a, const Quat &b, Quat &out) |
| Compose two rotation quaternions. | |
| Quat | QuatRotateByVector (const Quat &quat, const float *pRotVec) |
| Compose a rotation quaternion with a rotation vector. | |
| void | QuatSlerp (const Quat &from, const Quat &to, Quat &out, float flT) |
| Interpolate between two rotation quaternions along the shorter arc. | |
| void | Rnd::MakeRotMatrix (const Quat &quat, float *pMat3Rows) |
| Convert a rotation quaternion to a rotation matrix. | |
| void | Rnd::MakeEuler (const float *pMat3Rows, float *pAngles) |
| Extract Euler angles from a rotation matrix, inverting MakeRotMatrix() from three angles. | |
| void | Mat33ExtractScale (const float *pMat3Rows, float *pScale) |
| Report the scale each basis row carries. | |
| void | LerpEulerAngles (const float *pFrom, const float *pTo, float *pOut, float flT) |
| Interpolate between two sets of Euler angles the shorter way round each axis. | |
| Quat EulerAnglesToQuat | ( | const float * | pAngles | ) |
Build a rotation quaternion from three Euler angles.
The composition is the same one Rnd::MakeRotMatrix() produces from three angles. That is, the product is qz * qx * qy, with each factor a rotation about one axis by the matching component.
| pAngles | The three angles in radians, ordered X, Y, and Z. |
Compose two rotation quaternions.
The product is the Hamilton product of a and b in that order.
| a | The left factor. |
| b | The right factor. |
| out | Receives the product. Every component of both factors is loaded before the first store, which permits the destination to alias either factor. |
Compose a rotation quaternion with a rotation vector.
The rotation vector encodes its axis by direction and its angle by length. The result is the Hamilton product of the quaternion with the vector's own quaternion, in that order. A zero-length vector divides by zero and is not guarded against.
| quat | The rotation to start from. |
| pRotVec | The rotation vector, three floats. |
Interpolate between two rotation quaternions along the shorter arc.
A negative dot product flips the second quaternion. The interpolation therefore never takes the long way round. Both endpoint values of the parameter are special cased and copy an endpoint verbatim. Two nearly parallel inputs fall back to a component-wise linear blend, because the sine of the half angle underflows there.
The scale factors and the accumulation are double precision. This target has no double precision unit, and the compiler expands them into software calls. The arithmetic is genuinely slower than the surrounding single precision code. The trigonometry is single precision throughout.
| from | The rotation at a parameter of zero. |
| to | The rotation at a parameter of one. |
| out | Receives the interpolation. |
| flT | The interpolation parameter. |
| void Mat33ExtractScale | ( | const float * | pMat3Rows, |
| float * | pScale ) |
Report the scale each basis row carries.
Each scale is the length of its row. The Z scale is negated unless the dot product of the Z row with the cross product of the X and Y rows is positive. Rnd::Transformable::GetDrawXfm() and the routine at 0x00483030 call it.
| pMat3Rows | The basis, three rows of four floats. |
| pScale | Receives the three scales. |
| void LerpEulerAngles | ( | const float * | pFrom, |
| const float * | pTo, | ||
| float * | pOut, | ||
| float | flT ) |
Interpolate between two sets of Euler angles the shorter way round each axis.
Each component's difference is wrapped into the half-open range from minus one half turn to one half turn with fmodf(), scaled by flT, and added to the starting angle. No call site survives in the shipped program.
| pFrom | The angles at a parameter of zero, three floats. |
| pTo | The angles at a parameter of one, three floats. |
| pOut | Receives the interpolated angles, three floats. |
| flT | The interpolation parameter. |