libg3d Reference Manual | ||||
---|---|---|---|---|
#include <g3d/matrix.h> typedef G3DMatrix; gboolean g3d_matrix_identity (G3DMatrix *matrix); gboolean g3d_matrix_multiply (G3DMatrix *m1, G3DMatrix *m2, G3DMatrix *rm); gboolean g3d_matrix_translate (G3DFloat x, G3DFloat y, G3DFloat z, G3DMatrix *rm); gboolean g3d_matrix_rotate (G3DFloat angle, G3DFloat ax, G3DFloat ay, G3DFloat az, G3DMatrix *rm); gboolean g3d_matrix_rotate_xyz (G3DFloat rx, G3DFloat ry, G3DFloat rz, G3DMatrix *rm); gboolean g3d_matrix_scale (G3DFloat x, G3DFloat y, G3DFloat z, G3DMatrix *rm); gboolean g3d_matrix_transpose (G3DMatrix *matrix); G3DFloat g3d_matrix_determinant (G3DMatrix *matrix); gboolean g3d_matrix_dump (G3DMatrix *matrix);
Matrices in libg3d have the following layout:
G3DMatrix matrix[16]:
matrix[col * 4 + row] = f;
gboolean g3d_matrix_identity (G3DMatrix *matrix);
Sets the given matrix to the identity matrix.
|
4x4 matrix (float[16]) |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_multiply (G3DMatrix *m1, G3DMatrix *m2, G3DMatrix *rm);
Multiplies the matrixes.
|
first matrix |
|
second matrix |
|
resulting matrix |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_translate (G3DFloat x, G3DFloat y, G3DFloat z, G3DMatrix *rm);
Adds a translation to the the matrix.
|
x translation |
|
y translation |
|
z translation |
|
resulting matrix |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_rotate (G3DFloat angle, G3DFloat ax, G3DFloat ay, G3DFloat az, G3DMatrix *rm);
Adds a rotation to the matrix.
|
rotation angle |
|
x component of rotation axis |
|
y component of rotation axis |
|
z component of rotation axis |
|
resulting matrix |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_rotate_xyz (G3DFloat rx, G3DFloat ry, G3DFloat rz, G3DMatrix *rm);
Adds a rotation around the 3 coordinate system axes to the matrix.
|
rotation around x axis |
|
rotation around y axis |
|
rotation around z axis |
|
resulting matrix |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_scale (G3DFloat x, G3DFloat y, G3DFloat z, G3DMatrix *rm);
Adds a scaling to the matrix.
|
x factor |
|
y factor |
|
z factor |
|
resulting matrix |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_matrix_transpose (G3DMatrix *matrix);
Transposes the matrix.
|
the matrix |
Returns : |
TRUE on success, FALSE else |
G3DFloat g3d_matrix_determinant (G3DMatrix *matrix);
Calculate the determinant of the matrix (FIXME: not verified).
|
the matrix |
Returns : |
the determinant. |