LightsprintSDK 2021.08.08
|
#include <RRMath.h>
Public Member Functions | |
RRMatrix3x4 () | |
RRMatrix3x4 (const float *m3x4, bool transposed) | |
RRMatrix3x4 (const double *m3x4, bool transposed) | |
RRMatrix3x4 (float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23) | |
RRMatrix3x4 (double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23) | |
void | transformPosition (RRVec3 &a) const |
RRVec3 | getTransformedPosition (const RRVec3 &a) const |
void | transformDirection (RRVec3 &a) const |
RRVec3 | getTransformedDirection (const RRVec3 &a) const |
bool | operator== (const RRMatrix3x4 &a) const |
bool | operator!= (const RRMatrix3x4 &a) const |
RRMatrix3x4 | operator* (const RRMatrix3x4 &a) const |
RRMatrix3x4 & | operator*= (const RRMatrix3x4 &a) |
bool | isIdentity () const |
RRVec3 | getTranslation () const |
void | setTranslation (const RRVec3 &a) |
void | postTranslate (const RRVec3 &a) |
RRMatrix3x4 | centeredAround (const RRVec3 ¢er) const |
RRVec3 | getScale () const |
void | preScale (const RRVec3 &a) |
RRVec3 | getYawPitchRoll () const |
RRVec4 | getAxisAngle () const |
RRVec4 | getQuaternion () const |
RRVec3 | getColumn (unsigned i) const |
RRVec4 | getRow (unsigned i) const |
void | setColumn (unsigned i, const RRVec3 &column) |
void | setRow (unsigned i, const RRVec4 &row) |
RRReal | determinant3x3 () const |
bool | invertedTo (RRMatrix3x4 &destination) const |
void | blendLinear (const RRMatrix3x4 &sample0, const RRMatrix3x4 &sample1, RRReal blend) |
void | blendAkima (unsigned numSamples, const RRMatrix3x4 **samples, const RRReal *times, RRReal time) |
Static Public Member Functions | |
static RRMatrix3x4 | identity () |
static RRMatrix3x4 | scale (const RRVec3 &scale) |
static RRMatrix3x4 | translation (const RRVec3 &translation) |
static RRMatrix3x4 | rotationByYawPitchRoll (const RRVec3 &yawPitchRollRad) |
static RRMatrix3x4 | rotationByAxisAngle (const RRVec3 &rotationAxis, RRReal rotationAngleRad) |
static RRMatrix3x4 | rotationByQuaternion (const RRVec4 &quaternion) |
static RRMatrix3x4 | mirror (const RRVec4 &plane) |
Public Attributes | |
RRReal | m [3][4] |
Matrix of 3x4 real numbers in row-major order.
Translation is stored in m[x][3]. Rotation and scale in the rest.
We have chosen this format because it contains only what we need, is smaller than 4x4 and its shape makes no room for row or column major ambiguity.
Decomposition functions assume that matrix was composed from (in this order): scale, rotation and translation; so when composing matrices for later decomposition, use either m = translation() * rotationByYawPitchRoll() * scale();
or slightly faster but otherwise identical m = rotationByYawPitchRoll(); m.preScale(); m.postTranslate();
rr::RRMatrix3x4::RRMatrix3x4 | ( | ) |
rr::RRMatrix3x4::RRMatrix3x4 | ( | const float * | m3x4, |
bool | transposed | ||
) |
rr::RRMatrix3x4::RRMatrix3x4 | ( | const double * | m3x4, |
bool | transposed | ||
) |
rr::RRMatrix3x4::RRMatrix3x4 | ( | float | m00, |
float | m01, | ||
float | m02, | ||
float | m03, | ||
float | m10, | ||
float | m11, | ||
float | m12, | ||
float | m13, | ||
float | m20, | ||
float | m21, | ||
float | m22, | ||
float | m23 | ||
) |
rr::RRMatrix3x4::RRMatrix3x4 | ( | double | m00, |
double | m01, | ||
double | m02, | ||
double | m03, | ||
double | m10, | ||
double | m11, | ||
double | m12, | ||
double | m13, | ||
double | m20, | ||
double | m21, | ||
double | m22, | ||
double | m23 | ||
) |
|
static |
|
static |
|
static |
|
static |
Yaw + Pitch + Roll = YXZ Euler angles as defined at http://en.wikipedia.org/wiki/Euler_angles.
|
static |
|
static |
Expects normalized quaternion.
|
static |
void rr::RRMatrix3x4::transformPosition | ( | RRVec3 & | a | ) | const |
Transforms position in 3d space by matrix.
Returns position in 3d space transformed by matrix.
void rr::RRMatrix3x4::transformDirection | ( | RRVec3 & | a | ) | const |
Transforms direction in 3d space by matrix.
Returns direction in 3d space transformed by matrix.
bool rr::RRMatrix3x4::operator== | ( | const RRMatrix3x4 & | a | ) | const |
bool rr::RRMatrix3x4::operator!= | ( | const RRMatrix3x4 & | a | ) | const |
RRMatrix3x4 rr::RRMatrix3x4::operator* | ( | const RRMatrix3x4 & | a | ) | const |
A*B returns matrix that performs transformation B, then A.
RRMatrix3x4 & rr::RRMatrix3x4::operator*= | ( | const RRMatrix3x4 & | a | ) |
A*=B adds transformation B at the beginning of transformations defined by A. If you want B at the end, do A=B*A;.
bool rr::RRMatrix3x4::isIdentity | ( | ) | const |
Tests whether matrix is identity.
RRVec3 rr::RRMatrix3x4::getTranslation | ( | ) | const |
Returns translation component of matrix.
void rr::RRMatrix3x4::setTranslation | ( | const RRVec3 & | a | ) |
Sets translation component of matrix.
void rr::RRMatrix3x4::postTranslate | ( | const RRVec3 & | a | ) |
Applies translation on top of other transformations defined by this matrix, optimized *this=translation(a)**this;.
RRMatrix3x4 rr::RRMatrix3x4::centeredAround | ( | const RRVec3 & | center | ) | const |
Returns the same transformation with pretranslation -center and posttranslation +center.
RRVec3 rr::RRMatrix3x4::getScale | ( | ) | const |
Returns scale component of matrix. Negative scale is supported. Use getScale().abs().avg() for absolute uniform scale.
void rr::RRMatrix3x4::preScale | ( | const RRVec3 & | a | ) |
Applies scale before other transformations defined by this matrix; optimized this=scale(a);.
RRVec3 rr::RRMatrix3x4::getYawPitchRoll | ( | ) | const |
Returns rotation component of matrix as Yaw, Pitch and Roll = YXZ Euler angles as defined at http://en.wikipedia.org/wiki/Euler_angles.
Works for matrices that represent scale, rotation and translation (in this order) of rigid body, result is undefined for non-orthogonal matrices.
Yaw and roll are in -pi..pi range, pitch is in -pi/2..pi/2 range.
RRVec4 rr::RRMatrix3x4::getAxisAngle | ( | ) | const |
Returns rotation component of matrix as rotation axis (xyz) and rotation angle in radians (w) .
RRVec4 rr::RRMatrix3x4::getQuaternion | ( | ) | const |
Returns rotation component of matrix as normalized quaternion.
RRVec3 rr::RRMatrix3x4::getColumn | ( | unsigned | i | ) | const |
Returns i-th matrix column, for i=0,1,2,3.
RRVec4 rr::RRMatrix3x4::getRow | ( | unsigned | i | ) | const |
Returns i-th matrix row, for i=0,1,2.
void rr::RRMatrix3x4::setColumn | ( | unsigned | i, |
const RRVec3 & | column | ||
) |
Sets i-th matrix column, for i=0,1,2,3.
void rr::RRMatrix3x4::setRow | ( | unsigned | i, |
const RRVec4 & | row | ||
) |
Sets i-th matrix row, for i=0,1,2.
RRReal rr::RRMatrix3x4::determinant3x3 | ( | ) | const |
Returns determinant of first 3x3 elements.
bool rr::RRMatrix3x4::invertedTo | ( | RRMatrix3x4 & | destination | ) | const |
Inverts matrix. Returns false in case of failure, not changing destination.
void rr::RRMatrix3x4::blendLinear | ( | const RRMatrix3x4 & | sample0, |
const RRMatrix3x4 & | sample1, | ||
RRReal | blend | ||
) |
Fills this with linear interpolation of two samples; sample0 if blend=0, sample1 if blend=1.
void rr::RRMatrix3x4::blendAkima | ( | unsigned | numSamples, |
const RRMatrix3x4 ** | samples, | ||
const RRReal * | times, | ||
RRReal | time | ||
) |
Fills this with Akima interpolation of samples, non uniformly scattered on time scale.
numSamples | Number of elements in samples and times arrays. Interpolations uses at most 3 preceding and 3 following samples, providing more does not increase quality. |
samples | Pointers to numSamples samples. |
times | Array of times assigned to samples. |
time | Time assigned to sample generated by this function. |
RRReal rr::RRMatrix3x4::m[3][4] |
Direct access to matrix data.