Home | Download | Screen shots | Discussion | Documentation |
---|
#include <openvrml/basetypes.h>
Matrices are stored in row-major order.
Public Member Functions | |
mat4f () throw () | |
Construct. | |
mat4f (float f11, float f12, float f13, float f14, float f21, float f22, float f23, float f24, float f31, float f32, float f33, float f34, float f41, float f42, float f43, float f44) throw () | |
Construct mat4f with given 16 elements in row-major order. | |
mat4f (const float mat[16]) throw () | |
Construct from an array of 16 values. | |
mat4f (const float(&mat)[4][4]) throw () | |
Construct from a 4x4 array. | |
mat4f & | operator *= (float scalar) throw () |
Multiply by a scalar. | |
mat4f & | operator *= (const mat4f &mat) throw () |
Multiply by another matrix. | |
float (&operator[](const size_t index) throw())[4] | |
const | float (&operator[](const size_t index) const throw())[4] |
void | transformation (vec3f &t, openvrml::rotation &r, vec3f &s) const throw () |
Get the translation, rotation and scale from the orthogonal transformation matrix. | |
void | transformation (vec3f &t, openvrml::rotation &r, vec3f &s, vec3f &shear) const throw () |
Get the translation, rotation, scale and shear from an affine transformation matrix. | |
const mat4f | inverse () const throw () |
Get the inverse of an affine matrix. | |
const mat4f | transpose () const throw () |
Get the transposition of the matrix. | |
float | det () const throw () |
Determinant. | |
Static Public Member Functions | |
static const mat4f | rotation (const openvrml::rotation &rot) throw () |
Create a rotation matrix. | |
static const mat4f | rotation (const quatf &quat) throw () |
Create a rotation matrix. | |
static const mat4f | scale (float s) throw () |
Create a uniform scale matrix. | |
static const mat4f | scale (const vec3f &s) throw () |
Create a scale matrix. | |
static const mat4f | translation (const vec3f &t) throw () |
Create a translation matrix. | |
static const mat4f | transformation (const vec3f &t, const openvrml::rotation &r, const vec3f &s, const openvrml::rotation &sr, const vec3f &c) throw () |
Create a transformation matrix from a translation, a rotation, a scale, a scaleOrientation, and a center. | |
Private Attributes | |
float | mat [4][4] |
4x4 float matrix. | |
Related Functions | |
(Note that these are not member functions.) | |
const openvrml::mat4f | operator * (const mat4f &mat, const float scalar) throw() |
Multiply a matrix by a scalar value. | |
const openvrml::mat4f | operator * (const float scalar, const mat4f &mat) throw() |
Multiply a scalar value by matrix. | |
const openvrml::mat4f | operator * (const mat4f &lhs, const mat4f &rhs) throw() |
Multiply two matrices. | |
std::istream & | operator>> (std::istream &in, mat4f &m) |
Stream input. | |
std::ostream & | operator<< (std::ostream &out, const mat4f &mat) |
Stream output. | |
bool | operator== (const mat4f &lhs, const mat4f &rhs) throw() |
Equality comparison operator. | |
bool | operator!= (const mat4f &lhs, const mat4f &rhs) throw() |
Inequality comparison operator. |
openvrml::mat4f::mat4f | ( | ) | throw () |
Construct.
The matrix is initialized to the identity matrix.
openvrml::mat4f::mat4f | ( | float | f11, | |
float | f12, | |||
float | f13, | |||
float | f14, | |||
float | f21, | |||
float | f22, | |||
float | f23, | |||
float | f24, | |||
float | f31, | |||
float | f32, | |||
float | f33, | |||
float | f34, | |||
float | f41, | |||
float | f42, | |||
float | f43, | |||
float | f44 | |||
) | throw () |
Construct mat4f with given 16 elements in row-major order.
[in] | f11 | |
[in] | f12 | |
[in] | f13 | |
[in] | f14 | |
[in] | f21 | |
[in] | f22 | |
[in] | f23 | |
[in] | f24 | |
[in] | f31 | |
[in] | f32 | |
[in] | f33 | |
[in] | f34 | |
[in] | f41 | |
[in] | f42 | |
[in] | f43 | |
[in] | f44 |
openvrml::mat4f::mat4f | ( | const float | mat[16] | ) | throw () [explicit] |
Construct from an array of 16 values.
[in] | mat | an array of values in row-major order. |
openvrml::mat4f::mat4f | ( | const float & | mat[4][4] | ) | throw () [explicit] |
Construct from a 4x4 array.
[in] | mat | a 4x4 array of elements in row-major order. |
const openvrml::mat4f openvrml::mat4f::rotation | ( | const openvrml::rotation & | rot | ) | throw () [static] |
const openvrml::mat4f openvrml::mat4f::rotation | ( | const quatf & | quat | ) | throw () [static] |
Create a rotation matrix.
[in] | quat | a quaternion. |
quat
. const openvrml::mat4f openvrml::mat4f::scale | ( | float | s | ) | throw () [static] |
Create a uniform scale matrix.
[in] | s | scale factor. |
const openvrml::mat4f openvrml::mat4f::scale | ( | const vec3f & | s | ) | throw () [static] |
Create a scale matrix.
[in] | s | a vector. |
const openvrml::mat4f openvrml::mat4f::translation | ( | const vec3f & | t | ) | throw () [static] |
Create a translation matrix.
[in] | t | translation vector. |
const openvrml::mat4f openvrml::mat4f::transformation | ( | const vec3f & | t, | |
const openvrml::rotation & | r, | |||
const vec3f & | s, | |||
const openvrml::rotation & | sr, | |||
const vec3f & | c | |||
) | throw () [static] |
openvrml::mat4f & openvrml::mat4f::operator *= | ( | float | scalar | ) | throw () |
Multiply by a scalar.
[in] | scalar | value by which to multiply. |
openvrml::mat4f & openvrml::mat4f::operator *= | ( | const mat4f & | mat | ) | throw () |
Multiply by another matrix.
Sets the matrix equal to the matrix multiplied by mat
.
[in] | mat | the matrix by which to multiply. |
void openvrml::mat4f::transformation | ( | vec3f & | t, | |
openvrml::rotation & | r, | |||
vec3f & | s | |||
) | const throw () |
Get the translation, rotation and scale from the orthogonal transformation matrix.
Any projection or shear information in the matrix is ignored. The caller is responsible for assuring that the transformation is in fact orthogonal; otherwise the results are undefined.
[out] | t | translation. |
[out] | r | rotation. |
[out] | s | scale. |
void openvrml::mat4f::transformation | ( | vec3f & | t, | |
openvrml::rotation & | r, | |||
vec3f & | s, | |||
vec3f & | shear | |||
) | const throw () |
Get the translation, rotation, scale and shear from an affine transformation matrix.
Any projection information in the matrix is ignored. As VRML allows non-uniform scaling, it is safe to call this routine. The caller is responsible for assuring that the transformation matrix is in fact affine; otherwise the results are undefined.
[out] | t | translation. |
[out] | r | rotation. |
[out] | s | scale. |
[out] | shear | shear. |
const openvrml::mat4f openvrml::mat4f::inverse | ( | ) | const throw () |
Get the inverse of an affine matrix.
const openvrml::mat4f openvrml::mat4f::transpose | ( | ) | const throw () |
Get the transposition of the matrix.
float openvrml::mat4f::det | ( | ) | const throw () |
Determinant.
const openvrml::mat4f operator * | ( | const mat4f & | mat, | |
const float | scalar | |||
) | throw() [related] |
Multiply a matrix by a scalar value.
[in] | mat | matrix. |
[in] | scalar | scalar. |
const openvrml::mat4f operator * | ( | const float | scalar, | |
const mat4f & | mat | |||
) | throw() [related] |
Multiply a scalar value by matrix.
[in] | scalar | scalar. |
[in] | mat | matrix. |
const openvrml::mat4f operator * | ( | const mat4f & | lhs, | |
const mat4f & | rhs | |||
) | throw() [related] |
Multiply two matrices.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
std::istream & operator>> | ( | std::istream & | in, | |
mat4f & | m | |||
) | [related] |
Stream input.
Consistent with the VRML97 convention, commas (“,”) in the input are treated as whitespace.
Optionally, brackets may be used in the input to group the rows; i.e., the following syntaxes are accepted:
[in,out] | in | input stream. |
[out] | m | a matrix. |
in
. std::ostream & operator<< | ( | std::ostream & | out, | |
const mat4f & | mat | |||
) | [related] |
Stream output.
[in,out] | out | an output stream. |
[in] | mat | a matrix. |
out
. Equality comparison operator.
All componenents must match exactly.
[in] | lhs | a matrix. |
[in] | rhs | a matrix. |
true
if lhs
and rhs
are equivalent; false
otherwise. Inequality comparison operator.
[in] | lhs | a matrix. |
[in] | rhs | a matrix. |
true
if lhs
and rhs
are not equivalent; false
otherwise.
float openvrml::mat4f::mat[4][4] [private] |
4x4 float matrix.
For internal use only.