![]() |
![]() |
![]() |
Pigment 0.3 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <pgm/pgm.h> enum PgmMat4x4Predefined; PgmVec3; PgmVec4; PgmMat3x3; PgmMat4x4; PgmVec3 * pgm_vec3_new (void); PgmVec3 * pgm_vec3_new_from_scalars (gfloat v0, gfloat v1, gfloat v2); PgmVec3 * pgm_vec3_copy (PgmVec3 *vec3); void pgm_vec3_free (PgmVec3 *vec3); void pgm_vec3_set_from_scalars (PgmVec3 *vec3, gfloat v0, gfloat v1, gfloat v2); void pgm_vec3_set_from_vec3 (PgmVec3 *vec3, const PgmVec3 *v); gfloat pgm_vec3_length (PgmVec3 *vec3); PgmVec3 * pgm_vec3_normalize (PgmVec3 *vec3); gfloat pgm_vec3_dot_product (PgmVec3 *vec3, const PgmVec3 *v); PgmVec3 * pgm_vec3_cross_product (PgmVec3 *vec3, const PgmVec3 *v); PgmVec3 * pgm_vec3_add_scalar (PgmVec3 *vec3, gfloat s); PgmVec3 * pgm_vec3_add_vec3 (PgmVec3 *vec3, const PgmVec3 *v); PgmVec3 * pgm_vec3_substract_scalar (PgmVec3 *vec3, gfloat s); PgmVec3 * pgm_vec3_substract_vec3 (PgmVec3 *vec3, const PgmVec3 *v); PgmVec3 * pgm_vec3_multiply_scalar (PgmVec3 *vec3, gfloat s); PgmVec3 * pgm_vec3_multiply_vec3 (PgmVec3 *vec3, const PgmVec3 *v); gchar * pgm_vec3_to_string (PgmVec3 *vec3); PgmVec4 * pgm_vec4_new (void); PgmVec4 * pgm_vec4_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3); PgmVec4 * pgm_vec4_copy (PgmVec4 *vec4); void pgm_vec4_free (PgmVec4 *vec4); void pgm_vec4_set_from_scalars (PgmVec4 *vec4, gfloat v0, gfloat v1, gfloat v2, gfloat v3); void pgm_vec4_set_from_vec4 (PgmVec4 *vec4, const PgmVec4 *v); gfloat pgm_vec4_length (PgmVec4 *vec4); PgmVec4 * pgm_vec4_normalize (PgmVec4 *vec4); PgmVec4 * pgm_vec4_add_scalar (PgmVec4 *vec4, gfloat s); PgmVec4 * pgm_vec4_add_vec4 (PgmVec4 *vec4, const PgmVec4 *v); PgmVec4 * pgm_vec4_substract_scalar (PgmVec4 *vec4, gfloat s); PgmVec4 * pgm_vec4_substract_vec4 (PgmVec4 *vec4, const PgmVec4 *v); PgmVec4 * pgm_vec4_multiply_scalar (PgmVec4 *vec4, gfloat s); PgmVec4 * pgm_vec4_multiply_vec4 (PgmVec4 *vec4, const PgmVec4 *v); gchar * pgm_vec4_to_string (PgmVec4 *vec4); PgmMat3x3 * pgm_mat3x3_new (void); PgmMat3x3 * pgm_mat3x3_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8); PgmMat3x3 * pgm_mat3x3_new_from_vec3 (const PgmVec3 *v0, const PgmVec3 *v1, const PgmVec3 *v2); PgmMat3x3 * pgm_mat3x3_new_identity (void); PgmMat3x3 * pgm_mat3x3_copy (PgmMat3x3 *mat3x3); void pgm_mat3x3_free (PgmMat3x3 *mat3x3); void pgm_mat3x3_set_from_scalars (PgmMat3x3 *mat3x3, gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8); void pgm_mat3x3_set_from_vec3 (PgmMat3x3 *mat3x3, const PgmVec3 *v0, const PgmVec3 *v1, const PgmVec3 *v2); void pgm_mat3x3_set_from_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m); gboolean pgm_mat3x3_is_identity (PgmMat3x3 *mat3x3); PgmMat3x3 * pgm_mat3x3_inverse (PgmMat3x3 *mat3x3); PgmMat3x3 * pgm_mat3x3_transpose (PgmMat3x3 *mat3x3); PgmMat3x3 * pgm_mat3x3_add_scalar (PgmMat3x3 *mat3x3, gfloat s); PgmMat3x3 * pgm_mat3x3_add_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m); PgmMat3x3 * pgm_mat3x3_substract_scalar (PgmMat3x3 *mat3x3, gfloat s); PgmMat3x3 * pgm_mat3x3_substract_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m); PgmMat3x3 * pgm_mat3x3_multiply_scalar (PgmMat3x3 *mat3x3, gfloat s); PgmVec3 * pgm_mat3x3_multiply_vec3 (PgmMat3x3 *mat3x3, const PgmVec3 *v); PgmMat3x3 * pgm_mat3x3_multiply_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m); gchar * pgm_mat3x3_to_string (PgmMat3x3 *mat3x3); PgmMat4x4 * pgm_mat4x4_new (void); PgmMat4x4 * pgm_mat4x4_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8, gfloat v9, gfloat v10, gfloat v11, gfloat v12, gfloat v13, gfloat v14, gfloat v15); PgmMat4x4 * pgm_mat4x4_new_from_vec4 (const PgmVec4 *v0, const PgmVec4 *v1, const PgmVec4 *v2, const PgmVec4 *v3); PgmMat4x4 * pgm_mat4x4_new_identity (void); PgmMat4x4 * pgm_mat4x4_new_predefined (PgmMat4x4Predefined predefined); PgmMat4x4 * pgm_mat4x4_new_translate_from_vec3 (const PgmVec3 *t); PgmMat4x4 * pgm_mat4x4_new_translate_from_scalars (gfloat tx, gfloat ty, gfloat tz); PgmMat4x4 * pgm_mat4x4_new_scale_from_vec3 (const PgmVec3 *s); PgmMat4x4 * pgm_mat4x4_new_scale_from_scalars (gfloat sx, gfloat sy, gfloat sz); PgmMat4x4 * pgm_mat4x4_new_rotate_x (gfloat angle); PgmMat4x4 * pgm_mat4x4_new_rotate_y (gfloat angle); PgmMat4x4 * pgm_mat4x4_new_rotate_z (gfloat angle); PgmMat4x4 * pgm_mat4x4_new_rotate_axis_from_vec3 (gfloat angle, const PgmVec3 *axis); PgmMat4x4 * pgm_mat4x4_new_rotate_axis_from_scalars (gfloat angle, gfloat axis_x, gfloat axis_y, gfloat axis_z); PgmMat4x4 * pgm_mat4x4_copy (PgmMat4x4 *mat4x4); void pgm_mat4x4_free (PgmMat4x4 *mat4x4); void pgm_mat4x4_set_from_scalars (PgmMat4x4 *mat4x4, gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8, gfloat v9, gfloat v10, gfloat v11, gfloat v12, gfloat v13, gfloat v14, gfloat v15); void pgm_mat4x4_set_from_vec4 (PgmMat4x4 *mat4x4, const PgmVec4 *v0, const PgmVec4 *v1, const PgmVec4 *v2, const PgmVec4 *v3); void pgm_mat4x4_set_from_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m); gboolean pgm_mat4x4_is_identity (PgmMat4x4 *mat4x4); PgmMat4x4 * pgm_mat4x4_inverse (PgmMat4x4 *mat4x4); PgmMat4x4 * pgm_mat4x4_transpose (PgmMat4x4 *mat4x4); void pgm_mat4x4_translate_from_vec3 (PgmMat4x4 *mat4x4, const PgmVec3 *t); void pgm_mat4x4_translate_from_scalars (PgmMat4x4 *mat4x4, gfloat tx, gfloat ty, gfloat tz); void pgm_mat4x4_scale_from_vec3 (PgmMat4x4 *mat4x4, const PgmVec3 *s); void pgm_mat4x4_scale_from_scalars (PgmMat4x4 *mat4x4, gfloat sx, gfloat sy, gfloat sz); void pgm_mat4x4_rotate_x (PgmMat4x4 *mat4x4, gfloat angle); void pgm_mat4x4_rotate_y (PgmMat4x4 *mat4x4, gfloat angle); void pgm_mat4x4_rotate_z (PgmMat4x4 *mat4x4, gfloat angle); void pgm_mat4x4_rotate_axis_from_vec3 (PgmMat4x4 *mat4x4, gfloat angle, const PgmVec3 *axis); void pgm_mat4x4_rotate_axis_from_scalars (PgmMat4x4 *mat4x4, gfloat angle, gfloat axis_x, gfloat axis_y, gfloat axis_z); PgmMat4x4 * pgm_mat4x4_add_scalar (PgmMat4x4 *mat4x4, gfloat s); PgmMat4x4 * pgm_mat4x4_add_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m); PgmMat4x4 * pgm_mat4x4_substract_scalar (PgmMat4x4 *mat4x4, gfloat s); PgmMat4x4 * pgm_mat4x4_substract_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m); PgmMat4x4 * pgm_mat4x4_multiply_scalar (PgmMat4x4 *mat4x4, gfloat s); PgmVec4 * pgm_mat4x4_multiply_vec4 (PgmMat4x4 *mat4x4, const PgmVec4 *v); PgmMat4x4 * pgm_mat4x4_multiply_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m); gchar * pgm_mat4x4_to_string (PgmMat4x4 *mat4x4); PgmVec3 * pgm_intersection_line_plane (const PgmVec3 *l1, const PgmVec3 *l2, const PgmVec3 *p, const PgmVec3 *pu, const PgmVec3 *pv); gboolean pgm_point_belongs_rectangle (const PgmVec3 *p, const PgmVec3 *r, const PgmVec3 *ru, const PgmVec3 *rv);
Various linear algebra objects and utility functions simplifying the use of matrice and vector types.
In this documentation, we use the column vector notation for matrices and
matrix operations. That is also the notation used by the *_to_string()
functions, with the exception of pgm_vec3_to_string()
and
pgm_vec4_to_string()
for practical reasons.
Pigment matrices are stored in row-major order. This means that rows are stored one after the other. The difference between addresses of array cells in increasing rows is larger than addresses of cells in increasing columns.
Last reviewed on 2008-01-15 (0.3.2)
typedef enum { PGM_MAT4X4_FLIP_HORIZONTAL, PGM_MAT4X4_FLIP_VERTICAL, PGM_MAT4X4_ROTATE_CLOCKWISE, PGM_MAT4X4_ROTATE_COUNTER_CLOCKWISE } PgmMat4x4Predefined;
Predefined 4x4 matrices describing several common effects.
typedef struct { gfloat v[3]; } PgmVec3;
Describes a 3 components vector.
gfloat |
the 3 components vector array. |
typedef struct { gfloat v[4]; } PgmVec4;
Describes a 4 components vector.
gfloat |
the 4 components vector. |
typedef struct { gfloat m[9]; } PgmMat3x3;
Describes a 3x3 matrix.
gfloat |
the 3x3 matrix array in row-major order. |
typedef struct { gfloat m[16]; } PgmMat4x4;
Describes a 4x4 matrix.
gfloat |
the 4x4 matrix array in row-major order. |
PgmVec3 * pgm_vec3_new (void);
Creates a new PgmVec3 with components initialized at 0.0f.
MT safe.
Returns : |
a new PgmVec3 instance. |
PgmVec3 * pgm_vec3_new_from_scalars (gfloat v0, gfloat v1, gfloat v2);
Creates a new PgmVec3 with components initialized with the given scalars.
MT safe.
|
the 1st component. |
|
the 2nd component. |
|
the 3rd component. |
Returns : |
a new PgmVec3 instance. |
void pgm_vec3_free (PgmVec3 *vec3);
Frees all resources used by vec3
.
MT safe.
|
A PgmVec3 object. |
void pgm_vec3_set_from_scalars (PgmVec3 *vec3, gfloat v0, gfloat v1, gfloat v2);
Sets the components of vec3
with the given scalars.
MT safe.
|
A PgmVec3 object. |
|
the 1st component. |
|
the 2nd component. |
|
the 3rd component. |
void pgm_vec3_set_from_vec3 (PgmVec3 *vec3, const PgmVec3 *v);
Sets the components of vec3
with the given vector.
MT safe.
gfloat pgm_vec3_length (PgmVec3 *vec3);
Retrieves the length of the vector vec3
.
MT safe.
|
A PgmVec3 object. |
Returns : |
the length of vec3 .
|
PgmVec3 * pgm_vec3_normalize (PgmVec3 *vec3);
Retrieves the normalized vec3
vector.
MT safe.
|
A PgmVec3 object. |
Returns : |
the normalized vec3 vector, or NULL if vec3 is the zero vector.
|
gfloat pgm_vec3_dot_product (PgmVec3 *vec3, const PgmVec3 *v);
Computes the dot product vec3
∙ v
.
MT safe.
PgmVec3 * pgm_vec3_cross_product (PgmVec3 *vec3, const PgmVec3 *v);
Computes the dot product vec3
× v
.
MT safe.
PgmVec3 * pgm_vec3_add_scalar (PgmVec3 *vec3, gfloat s);
Computes the sum vec3
+ s
.
MT safe.
PgmVec3 * pgm_vec3_add_vec3 (PgmVec3 *vec3, const PgmVec3 *v);
Computes the sum vec3
+ v
.
MT safe.
PgmVec3 * pgm_vec3_substract_scalar (PgmVec3 *vec3, gfloat s);
Computes the substraction vec3
- s
.
MT safe.
PgmVec3 * pgm_vec3_substract_vec3 (PgmVec3 *vec3, const PgmVec3 *v);
Computes the substraction vec3
- v
.
MT safe.
PgmVec3 * pgm_vec3_multiply_scalar (PgmVec3 *vec3, gfloat s);
Computes the multiplication vec3
. s
.
MT safe.
PgmVec3 * pgm_vec3_multiply_vec3 (PgmVec3 *vec3, const PgmVec3 *v);
Computes the component by component multiplication vec3
. v
.
MT safe.
gchar * pgm_vec3_to_string (PgmVec3 *vec3);
Converts vec3
to a string representation.
This function, as well as pgm_vec4_to_string()
, returns a representation
of vec3
in row vector notation. This is practical for most usages since
it fits in one line.
MT safe.
|
A PgmVec3 object. |
Returns : |
a newly allocated string representing vec3 as a row.
|
PgmVec4 * pgm_vec4_new (void);
Creates a new PgmVec4 with components initilized at 0.0f.
MT safe.
Returns : |
a new PgmVec4 instance. |
PgmVec4 * pgm_vec4_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3);
Creates a new PgmVec4 with components initialized with the given scalars.
MT safe.
|
the 1st component. |
|
the 2nd component. |
|
the 3rd component. |
|
the 4th component. |
Returns : |
a new PgmVec4 instance. |
void pgm_vec4_free (PgmVec4 *vec4);
Frees all resources used by vec4
.
MT safe.
|
A PgmVec4 object. |
void pgm_vec4_set_from_scalars (PgmVec4 *vec4, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
Sets the components of vec4
with the given scalars.
MT safe.
|
A PgmVec4 object. |
|
the 1st component. |
|
the 2nd component. |
|
the 3rd component. |
|
the 4th component. |
void pgm_vec4_set_from_vec4 (PgmVec4 *vec4, const PgmVec4 *v);
Sets the components of vec4
with the given vector.
MT safe.
gfloat pgm_vec4_length (PgmVec4 *vec4);
Retrieves the length of the vector vec4
.
MT safe.
|
A PgmVec4 object. |
Returns : |
the length of vec4 .
|
PgmVec4 * pgm_vec4_normalize (PgmVec4 *vec4);
Retrieves the normalized vec4
vector.
MT safe.
|
A PgmVec4 object. |
Returns : |
the normalized vec4 vector, or NULL if vec4 is the zero vector.
|
PgmVec4 * pgm_vec4_add_scalar (PgmVec4 *vec4, gfloat s);
Computes the sum vec4
+ s
.
MT safe.
PgmVec4 * pgm_vec4_add_vec4 (PgmVec4 *vec4, const PgmVec4 *v);
Computes the sum vec4
+ v
.
MT safe.
PgmVec4 * pgm_vec4_substract_scalar (PgmVec4 *vec4, gfloat s);
Computes the substraction vec4
- s
.
MT safe.
PgmVec4 * pgm_vec4_substract_vec4 (PgmVec4 *vec4, const PgmVec4 *v);
Computes the substraction vec4
- v
.
MT safe.
PgmVec4 * pgm_vec4_multiply_scalar (PgmVec4 *vec4, gfloat s);
Computes the multiplication vec4
. s
.
MT safe.
PgmVec4 * pgm_vec4_multiply_vec4 (PgmVec4 *vec4, const PgmVec4 *v);
Computes the component by component multiplication vec4
. v
.
MT safe.
gchar * pgm_vec4_to_string (PgmVec4 *vec4);
Converts vec4
to a string representation.
This function, as well as pgm_vec3_to_string()
, returns a representation
of vec4
in row vector notation. This is practical for most usages since
it fits in one line.
MT safe.
|
A PgmVec4 object. |
Returns : |
a newly allocated string representing vec4 as a row.
|
PgmMat3x3 * pgm_mat3x3_new (void);
Creates a new PgmMat3x3 with components initilized at 0.0f.
MT safe.
Returns : |
a new PgmMat3x3 instance. |
PgmMat3x3 * pgm_mat3x3_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8);
Creates a new PgmMat3x3 with components initialized with the given scalars.
MT safe.
|
the 1st component of the 1st vector. |
|
the 2nd component of the 1st vector. |
|
the 3rd component of the 1st vector. |
|
the 1st component of the 2nd vector. |
|
the 2nd component of the 2nd vector. |
|
the 3rd component of the 2nd vector. |
|
the 1st component of the 3rd vector. |
|
the 2nd component of the 3rd vector. |
|
the 3rd component of the 3rd vector. |
Returns : |
a new PgmMat3x3 instance. |
PgmMat3x3 * pgm_mat3x3_new_from_vec3 (const PgmVec3 *v0, const PgmVec3 *v1, const PgmVec3 *v2);
Creates a new PgmMat3x3 with components initialized with the given vectors.
MT safe.
|
the 1st vector. |
|
the 2nd vector. |
|
the 3rd vector. |
Returns : |
a new PgmMat3x3 instance. |
PgmMat3x3 * pgm_mat3x3_new_identity (void);
Creates a new PgmMat3x3 identity matrix.
MT safe.
Returns : |
a new PgmMat3x3 instance. |
void pgm_mat3x3_free (PgmMat3x3 *mat3x3);
Frees all resources used by mat3x3
.
MT safe.
|
A PgmMat3x3 object. |
void pgm_mat3x3_set_from_scalars (PgmMat3x3 *mat3x3, gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8);
Set the components of mat3x3
with the given scalars.
MT safe.
|
A PgmMat3x3 object. |
|
the 1st component of the 1st vector. |
|
the 2nd component of the 1st vector. |
|
the 3rd component of the 1st vector. |
|
the 1st component of the 2nd vector. |
|
the 2nd component of the 2nd vector. |
|
the 3rd component of the 2nd vector. |
|
the 1st component of the 3rd vector. |
|
the 2nd component of the 3rd vector. |
|
the 3rd component of the 3rd vector. |
void pgm_mat3x3_set_from_vec3 (PgmMat3x3 *mat3x3, const PgmVec3 *v0, const PgmVec3 *v1, const PgmVec3 *v2);
Set the components of mat3x3
with the given vectors.
MT safe.
|
A PgmMat3x3 object. |
|
the 1st vector. |
|
the 1st vector. |
|
the 1st vector. |
void pgm_mat3x3_set_from_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m);
Sets the components of mat3x3
with the given matrix.
MT safe.
gboolean pgm_mat3x3_is_identity (PgmMat3x3 *mat3x3);
Retrieves whether or not mat3x3
is the identity matrix.
MT safe.
PgmMat3x3 * pgm_mat3x3_inverse (PgmMat3x3 *mat3x3);
Retrieves the inverted mat3x3
matrix.
MT safe.
PgmMat3x3 * pgm_mat3x3_transpose (PgmMat3x3 *mat3x3);
Retrieves the transposed mat3x3
matrix.
MT safe.
PgmMat3x3 * pgm_mat3x3_add_scalar (PgmMat3x3 *mat3x3, gfloat s);
Computes the sum mat3x3
+ s
.
MT safe.
PgmMat3x3 * pgm_mat3x3_add_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m);
Computes the sum mat3x3
+ m
.
MT safe.
PgmMat3x3 * pgm_mat3x3_substract_scalar (PgmMat3x3 *mat3x3, gfloat s);
Computes the substraction mat3x3
- s
.
MT safe.
PgmMat3x3 * pgm_mat3x3_substract_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m);
Computes the substraction mat3x3
- m
.
MT safe.
PgmMat3x3 * pgm_mat3x3_multiply_scalar (PgmMat3x3 *mat3x3, gfloat s);
Computes the multiplication mat3x3
. s
.
MT safe.
PgmVec3 * pgm_mat3x3_multiply_vec3 (PgmMat3x3 *mat3x3, const PgmVec3 *v);
Computes the multiplication mat3x3
. v
.
MT safe.
PgmMat3x3 * pgm_mat3x3_multiply_mat3x3 (PgmMat3x3 *mat3x3, const PgmMat3x3 *m);
Computes the multiplication mat3x3
. m
. Note that it is a
post-multiplication of mat3x3
by m
.
MT safe.
gchar * pgm_mat3x3_to_string (PgmMat3x3 *mat3x3);
Converts mat3x3
to a string representation.
MT safe.
|
A PgmMat3x3 object. |
Returns : |
a newly allocated string representing mat3x3 .
|
PgmMat4x4 * pgm_mat4x4_new (void);
Creates a new PgmMat4x4 with components initilized at 0.0f.
MT safe.
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_from_scalars (gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8, gfloat v9, gfloat v10, gfloat v11, gfloat v12, gfloat v13, gfloat v14, gfloat v15);
Creates a new PgmMat4x4 with components initialized with the given scalars.
MT safe.
|
the 1st component of the 1st vector. |
|
the 2nd component of the 1st vector. |
|
the 3rd component of the 1st vector. |
|
the 4th component of the 1st vector. |
|
the 1st component of the 2nd vector. |
|
the 2nd component of the 2nd vector. |
|
the 3rd component of the 2nd vector. |
|
the 4th component of the 2nd vector. |
|
the 1st component of the 3rd vector. |
|
the 2nd component of the 3rd vector. |
|
the 3rd component of the 3rd vector. |
|
the 4th component of the 3rd vector. |
|
the 1st component of the 4th vector. |
|
the 2nd component of the 4th vector. |
|
the 3rd component of the 4th vector. |
|
the 4th component of the 4th vector. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_from_vec4 (const PgmVec4 *v0, const PgmVec4 *v1, const PgmVec4 *v2, const PgmVec4 *v3);
Creates a new PgmMat4x4 with components initialized with the given vectors.
MT safe.
|
the 1st vector. |
|
the 2nd vector. |
|
the 3rd vector. |
|
the 4th vector. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_identity (void);
Creates a new PgmMat4x4 identity matrix.
MT safe.
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_predefined (PgmMat4x4Predefined predefined);
Creates a new PgmMat4x4 matrix corresponding to predefined
.
MT safe.
|
The predefined 4x4 matrix. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_translate_from_vec3 (const PgmVec3 *t);
Creates a new PgmMat4x4 translation matrix.
MT safe.
PgmMat4x4 * pgm_mat4x4_new_translate_from_scalars (gfloat tx, gfloat ty, gfloat tz);
Creates a new PgmMat4x4 translation matrix.
MT safe.
|
The translation on the x cardinal axis. |
|
The translation on the y cardinal axis. |
|
The translation on the z cardinal axis. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_scale_from_vec3 (const PgmVec3 *s);
Creates a new PgmMat4x4 scaling matrix.
MT safe.
PgmMat4x4 * pgm_mat4x4_new_scale_from_scalars (gfloat sx, gfloat sy, gfloat sz);
Creates a new PgmMat4x4 scaling matrix.
MT safe.
|
The scale on the x cardinal axis. |
|
The scale on the y cardinal axis. |
|
The scale on the z cardinal axis. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_rotate_x (gfloat angle);
Creates a new PgmMat4x4 matrix for a rotation about the x cardinal axis.
MT safe.
|
The angle of rotation, in radians. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_rotate_y (gfloat angle);
Creates a new PgmMat4x4 matrix for a rotation about the y cardinal axis.
MT safe.
|
The angle of rotation, in radians. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_rotate_z (gfloat angle);
Creates a new PgmMat4x4 matrix for a rotation about the z cardinal axis.
MT safe.
|
The angle of rotation, in radians. |
Returns : |
a new PgmMat4x4 instance. |
PgmMat4x4 * pgm_mat4x4_new_rotate_axis_from_vec3 (gfloat angle, const PgmVec3 *axis);
Creates a new PgmMat4x4 matrix for a rotation about axis
.
MT safe.
PgmMat4x4 * pgm_mat4x4_new_rotate_axis_from_scalars (gfloat angle, gfloat axis_x, gfloat axis_y, gfloat axis_z);
Creates a new PgmMat4x4 matrix for a rotation about the given axis.
MT safe.
|
The angle of rotation, in radians. |
|
The x component of the axis of rotation. |
|
The y component of the axis of rotation. |
|
The z component of the axis of rotation. |
Returns : |
a new PgmMat4x4 instance. |
void pgm_mat4x4_free (PgmMat4x4 *mat4x4);
Frees all resources used by mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
void pgm_mat4x4_set_from_scalars (PgmMat4x4 *mat4x4, gfloat v0, gfloat v1, gfloat v2, gfloat v3, gfloat v4, gfloat v5, gfloat v6, gfloat v7, gfloat v8, gfloat v9, gfloat v10, gfloat v11, gfloat v12, gfloat v13, gfloat v14, gfloat v15);
Set the components of mat4x4
with the given scalars.
MT safe.
|
A PgmMat4x4 object. |
|
the 1st component of the 1st vector. |
|
the 2nd component of the 1st vector. |
|
the 3rd component of the 1st vector. |
|
the 4th component of the 1st vector. |
|
the 1st component of the 2nd vector. |
|
the 2nd component of the 2nd vector. |
|
the 3rd component of the 2nd vector. |
|
the 4th component of the 2nd vector. |
|
the 1st component of the 3rd vector. |
|
the 2nd component of the 3rd vector. |
|
the 3rd component of the 3rd vector. |
|
the 4th component of the 3rd vector. |
|
the 1st component of the 4th vector. |
|
the 2nd component of the 4th vector. |
|
the 3rd component of the 4th vector. |
|
the 4th component of the 4th vector. |
void pgm_mat4x4_set_from_vec4 (PgmMat4x4 *mat4x4, const PgmVec4 *v0, const PgmVec4 *v1, const PgmVec4 *v2, const PgmVec4 *v3);
Set the components of mat4x4
with the given vectors.
MT safe.
|
A PgmMat4x4 object. |
|
the 1st vector. |
|
the 2nd vector. |
|
the 3rd vector. |
|
the 4th vector. |
void pgm_mat4x4_set_from_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m);
Sets the components of mat4x4
with the given matrix.
MT safe.
gboolean pgm_mat4x4_is_identity (PgmMat4x4 *mat4x4);
Retrieves whether or not mat4x4
is the identity matrix.
MT safe.
PgmMat4x4 * pgm_mat4x4_inverse (PgmMat4x4 *mat4x4);
Retrieves the inverted mat4x4
matrix.
MT safe.
PgmMat4x4 * pgm_mat4x4_transpose (PgmMat4x4 *mat4x4);
Retrieves the transposed mat4x4
matrix.
MT safe.
void pgm_mat4x4_translate_from_vec3 (PgmMat4x4 *mat4x4, const PgmVec3 *t);
Post multiplies mat4x4
by a translation matrix with the product replacing
mat4x4
.
MT safe.
void pgm_mat4x4_translate_from_scalars (PgmMat4x4 *mat4x4, gfloat tx, gfloat ty, gfloat tz);
Post multiplies mat4x4
by a translation matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The translation on the x cardinal axis. |
|
The translation on the y cardinal axis. |
|
The translation on the z cardinal axis. |
void pgm_mat4x4_scale_from_vec3 (PgmMat4x4 *mat4x4, const PgmVec3 *s);
Post multiplies mat4x4
by a scaling matrix with the product replacing
mat4x4
.
MT safe.
void pgm_mat4x4_scale_from_scalars (PgmMat4x4 *mat4x4, gfloat sx, gfloat sy, gfloat sz);
Post multiplies mat4x4
by a scaling matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The scale to apply on the x axis. |
|
The scale to apply on the y axis. |
|
The scale to apply on the z axis. |
void pgm_mat4x4_rotate_x (PgmMat4x4 *mat4x4, gfloat angle);
Post multiplies mat4x4
by a rotation matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The angle of rotation, in radians. |
void pgm_mat4x4_rotate_y (PgmMat4x4 *mat4x4, gfloat angle);
Post multiplies mat4x4
by a rotation matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The angle of rotation, in radians. |
void pgm_mat4x4_rotate_z (PgmMat4x4 *mat4x4, gfloat angle);
Post multiplies mat4x4
by a rotation matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The angle of rotation, in radians. |
void pgm_mat4x4_rotate_axis_from_vec3 (PgmMat4x4 *mat4x4, gfloat angle, const PgmVec3 *axis);
Post multiplies mat4x4
by a rotation matrix with the product replacing
mat4x4
.
MT safe.
void pgm_mat4x4_rotate_axis_from_scalars (PgmMat4x4 *mat4x4, gfloat angle, gfloat axis_x, gfloat axis_y, gfloat axis_z);
Post multiplies mat4x4
by a rotation matrix with the product replacing
mat4x4
.
MT safe.
|
A PgmMat4x4 object. |
|
The angle of rotation, in radians. |
|
The x component of the axis of rotation. |
|
The y component of the axis of rotation. |
|
The z component of the axis of rotation. |
PgmMat4x4 * pgm_mat4x4_add_scalar (PgmMat4x4 *mat4x4, gfloat s);
Computes the sum mat4x4
+ s
.
MT safe.
PgmMat4x4 * pgm_mat4x4_add_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m);
Computes the sum mat4x4
+ m
.
MT safe.
PgmMat4x4 * pgm_mat4x4_substract_scalar (PgmMat4x4 *mat4x4, gfloat s);
Computes the substraction mat4x4
- s
.
MT safe.
PgmMat4x4 * pgm_mat4x4_substract_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m);
Computes the substraction mat4x4
- m
.
MT safe.
PgmMat4x4 * pgm_mat4x4_multiply_scalar (PgmMat4x4 *mat4x4, gfloat s);
Computes the multiplication mat4x4
. s
.
MT safe.
PgmVec4 * pgm_mat4x4_multiply_vec4 (PgmMat4x4 *mat4x4, const PgmVec4 *v);
Computes the multiplication mat4x4
. v
.
MT safe.
PgmMat4x4 * pgm_mat4x4_multiply_mat4x4 (PgmMat4x4 *mat4x4, const PgmMat4x4 *m);
Computes the multiplication mat4x4
. m
. Note that this a
post-multiplication of mat4x4
by m
.
MT safe.
gchar * pgm_mat4x4_to_string (PgmMat4x4 *mat4x4);
Converts mat4x4
to a string representation.
MT safe.
|
A PgmMat4x4 object. |
Returns : |
a newly allocated string representing mat4x4 .
|
PgmVec3 * pgm_intersection_line_plane (const PgmVec3 *l1, const PgmVec3 *l2, const PgmVec3 *p, const PgmVec3 *pu, const PgmVec3 *pv);
Retrieves the intersection point of the line defined by l1
and l2
with
the plane defined by p
, pu
and pv
.
pu
and pv
must not be colinear. If the line belongs to the plane then
it's considered as if there is no intersection.
MT safe.
|
A PgmVec3 representing a 1st point of the line. |
|
A PgmVec3 representing a 2nd point of the line. |
|
A PgmVec3 representing point of the plane. |
|
A PgmVec3 representing a 1st vector colinear to the plane. |
|
A PgmVec3 representing a 2nd vector colinear to the plane. |
Returns : |
the intersection point in a newly allocated PgmVec3 if any, NULL otherwise. |
gboolean pgm_point_belongs_rectangle (const PgmVec3 *p, const PgmVec3 *r, const PgmVec3 *ru, const PgmVec3 *rv);
Retrieves if the point p
belongs to the rectangle defined by the point
r
and the vectors ru
and rv
.
MT safe.
|
A PgmVec3 representing the point. |
|
A PgmVec3 representing the top-left corner position of the rectangle. |
|
A PgmVec3 representing the top edge of the rectangle. |
|
a 3 components vector defining the left edge of the rectangle. |
Returns : |
TRUE if p belongs to the rectangle, FALSE otherwise.
|