PgmLinearAlgebra

## PgmLinearAlgebra PgmLinearAlgebra — Various linear algebra objects and utility functions. |

## Synopsis

    #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);

## Description

### Notation

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)

## Details

### enum PgmMat4x4Predefined

    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.

`PGM_MAT4X4_FLIP_HORIZONTAL` | Horizontal flipping.
`PGM_MAT4X4_FLIP_VERTICAL` | Vertical flipping.
`PGM_MAT4X4_ROTATE_CLOCKWISE` | Clockwise rotation.
`PGM_MAT4X4_ROTATE_COUNTER_CLOCKWISE` | Counter-clockwise rotation.

### PgmVec3

    typedef struct {
      gfloat v[3];
    } PgmVec3;

Describes a 3 components vector.

gfloat `v`[3]; | the 3 components vector array.

### PgmVec4

    typedef struct {
      gfloat v[4];
    } PgmVec4;

Describes a 4 components vector.

gfloat `v`[4]; | the 4 components vector.

### PgmMat3x3

    typedef struct {
      gfloat m[9];
    } PgmMat3x3;

Describes a 3x3 matrix.

gfloat `m`[9]; | the 3x3 matrix array in row-major order.

### PgmMat4x4

    typedef struct {
      gfloat m[16];
    } PgmMat4x4;

Describes a 4x4 matrix.

gfloat `m`[16]; | the 4x4 matrix array in row-major order.

### pgm_vec3_new ()

    PgmVec3 *           pgm_vec3_new                        (void);

Creates a new PgmVec3 with components initialized at 0.0f.

MT safe.

Returns : | a new PgmVec3 instance.

### pgm_vec3_new_from_scalars ()

    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.

`v0` : | the 1st component.
`v1` : | the 2nd component.
`v2` : | the 3rd component.
Returns : | a new PgmVec3 instance.

### pgm_vec3_copy ()

    PgmVec3 *           pgm_vec3_copy                       (PgmVec3 *vec3);

Copies `vec3`.

MT safe.

`vec3` : | a PgmVec3 object.
Returns : | a newly allocated PgmVec3.

### pgm_vec3_free ()

    void                pgm_vec3_free                       (PgmVec3 *vec3);

Frees all resources used by `vec3`.

MT safe.

`vec3` : | A PgmVec3 object.

### pgm_vec3_set_from_scalars ()

    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.

`vec3` : | A PgmVec3 object.
`v0` : | the 1st component.
`v1` : | the 2nd component.
`v2` : | the 3rd component.

### pgm_vec3_set_from_vec3 ()

    void                pgm_vec3_set_from_vec3              (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Sets the components of `vec3` with the given vector.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.

### pgm_vec3_length ()

    gfloat              pgm_vec3_length                     (PgmVec3 *vec3);

Retrieves the length of the vector `vec3`.

MT safe.

`vec3` : | A PgmVec3 object.
Returns : | the length of `vec3`.

### pgm_vec3_normalize ()

    PgmVec3 *           pgm_vec3_normalize                  (PgmVec3 *vec3);

Retrieves the normalized `vec3` vector.

MT safe.

`vec3` : | A PgmVec3 object.
Returns : | the normalized `vec3` vector, or NULL if `vec3` is the zero vector.

### pgm_vec3_dot_product ()

    gfloat              pgm_vec3_dot_product                (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Computes the dot product `vec3` ∙ `v`.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.
Returns : | the dot product `vec3` ∙ `v`.

### pgm_vec3_cross_product ()

    PgmVec3 *           pgm_vec3_cross_product              (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Computes the dot product `vec3` × `v`.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.
Returns : | the cross product `vec3` × `v` in a newly allocated PgmVec3.

### pgm_vec3_add_scalar ()

    PgmVec3 *           pgm_vec3_add_scalar                 (PgmVec3 *vec3,
                                                             gfloat s);

Computes the sum `vec3` + `s`.

MT safe.

`vec3` : | A PgmVec3 object.
`s` : | A scalar.
Returns : | the sum `vec3` + `s` in a newly allocated PgmVec3.

### pgm_vec3_add_vec3 ()

    PgmVec3 *           pgm_vec3_add_vec3                   (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Computes the sum `vec3` + `v`.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.
Returns : | the sum `vec3` + `v` in a newly allocated PgmVec3.

### pgm_vec3_substract_scalar ()

    PgmVec3 *           pgm_vec3_substract_scalar           (PgmVec3 *vec3,
                                                             gfloat s);

Computes the substraction `vec3` - `s`.

MT safe.

`vec3` : | A PgmVec3 object.
`s` : | A scalar.
Returns : | the substraction `vec3` - `s` in a newly allocated PgmVec3.

### pgm_vec3_substract_vec3 ()

    PgmVec3 *           pgm_vec3_substract_vec3             (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Computes the substraction `vec3` - `v`.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.
Returns : | the substraction `vec3` - `v` in a newly allocated PgmVec3.

### pgm_vec3_multiply_scalar ()

    PgmVec3 *           pgm_vec3_multiply_scalar            (PgmVec3 *vec3,
                                                             gfloat s);

Computes the multiplication `vec3` . `s`.

MT safe.

`vec3` : | A PgmVec3 object.
`s` : | A scalar.
Returns : | the multiplication `vec3` . `s` in a newly allocated PgmVec3.

### pgm_vec3_multiply_vec3 ()

    PgmVec3 *           pgm_vec3_multiply_vec3              (PgmVec3 *vec3,
                                                             const PgmVec3 *v);

Computes the component by component multiplication `vec3` . `v`.

MT safe.

`vec3` : | A PgmVec3 object.
`v` : | A PgmVec3 object.
Returns : | the component by component multiplication `vec3` . `v` in a newly allocated PgmVec3.

### pgm_vec3_to_string ()

    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.

`vec3` : | A PgmVec3 object.
Returns : | a newly allocated string representing `vec3` as a row.

### pgm_vec4_new ()

    PgmVec4 *           pgm_vec4_new                        (void);

Creates a new PgmVec4 with components initilized at 0.0f.

MT safe.

Returns : | a new PgmVec4 instance.

### pgm_vec4_new_from_scalars ()

    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.

`v0` : | the 1st component.
`v1` : | the 2nd component.
`v2` : | the 3rd component.
`v3` : | the 4th component.
Returns : | a new PgmVec4 instance.

### pgm_vec4_copy ()

    PgmVec4 *           pgm_vec4_copy                       (PgmVec4 *vec4);

Copies `vec4`.

MT safe.

`vec4` : | a PgmVec4 object.
Returns : | a newly allocated PgmVec4.

### pgm_vec4_free ()

    void                pgm_vec4_free                       (PgmVec4 *vec4);

Frees all resources used by `vec4`.

MT safe.

`vec4` : | A PgmVec4 object.

### pgm_vec4_set_from_scalars ()

    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.

`vec4` : | A PgmVec4 object.
`v0` : | the 1st component.
`v1` : | the 2nd component.
`v2` : | the 3rd component.
`v3` : | the 4th component.

### pgm_vec4_set_from_vec4 ()

    void                pgm_vec4_set_from_vec4              (PgmVec4 *vec4,
                                                             const PgmVec4 *v);

Sets the components of `vec4` with the given vector.

MT safe.

`vec4` : | A PgmVec4 object.
`v` : | A PgmVec4 object.

### pgm_vec4_length ()

    gfloat              pgm_vec4_length                     (PgmVec4 *vec4);

Retrieves the length of the vector `vec4`.

MT safe.

`vec4` : | A PgmVec4 object.
Returns : | the length of `vec4`.

### pgm_vec4_normalize ()

    PgmVec4 *           pgm_vec4_normalize                  (PgmVec4 *vec4);

Retrieves the normalized `vec4` vector.

MT safe.

`vec4` : | A PgmVec4 object.
Returns : | the normalized `vec4` vector, or NULL if `vec4` is the zero vector.

### pgm_vec4_add_scalar ()

    PgmVec4 *           pgm_vec4_add_scalar                 (PgmVec4 *vec4,
                                                             gfloat s);

Computes the sum `vec4` + `s`.

MT safe.

`vec4` : | A PgmVec4 object.
`s` : | A scalar.
Returns : | the sum `vec4` + `s` in a newly allocated PgmVec4.

### pgm_vec4_add_vec4 ()

    PgmVec4 *           pgm_vec4_add_vec4                   (PgmVec4 *vec4,
                                                             const PgmVec4 *v);

Computes the sum `vec4` + `v`.

MT safe.

`vec4` : | A PgmVec4 object.
`v` : | A PgmVec4 object.
Returns : | the sum `vec4` + `v` in a newly allocated PgmVec4.

### pgm_vec4_substract_scalar ()

    PgmVec4 *           pgm_vec4_substract_scalar           (PgmVec4 *vec4,
                                                             gfloat s);

Computes the substraction `vec4` - `s`.

MT safe.

`vec4` : | A PgmVec4 object.
`s` : | A scalar.
Returns : | the substraction `vec4` - `s` in a newly allocated PgmVec4.

### pgm_vec4_substract_vec4 ()

    PgmVec4 *           pgm_vec4_substract_vec4             (PgmVec4 *vec4,
                                                             const PgmVec4 *v);

Computes the substraction `vec4` - `v`.

MT safe.

`vec4` : | A PgmVec4 object.
`v` : | A PgmVec4 object.
Returns : | the substraction `vec4` - `v` in a newly allocated PgmVec4.

### pgm_vec4_multiply_scalar ()

    PgmVec4 *           pgm_vec4_multiply_scalar            (PgmVec4 *vec4,
                                                             gfloat s);

Computes the multiplication `vec4` . `s`.

MT safe.

`vec4` : | A PgmVec4 object.
`s` : | A scalar.
Returns : | the multiplication `vec4` . `s` in a newly allocated PgmVec4.

### pgm_vec4_multiply_vec4 ()

    PgmVec4 *           pgm_vec4_multiply_vec4              (PgmVec4 *vec4,
                                                             const PgmVec4 *v);

Computes the component by component multiplication `vec4` . `v`.

MT safe.

`vec4` : | A PgmVec4 object.
`v` : | A PgmVec4 object.
Returns : | the component by component multiplication `vec4` . `v` in a newly allocated PgmVec4.

### pgm_vec4_to_string ()

    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.

`vec4` : | A PgmVec4 object.
Returns : | a newly allocated string representing `vec4` as a row.

### pgm_mat3x3_new ()

    PgmMat3x3 *         pgm_mat3x3_new                      (void);

Creates a new PgmMat3x3 with components initilized at 0.0f.

MT safe.

Returns : | a new PgmMat3x3 instance.

### pgm_mat3x3_new_from_scalars ()

    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.

`v0` : | the 1st component of the 1st vector.
`v1` : | the 2nd component of the 1st vector.
`v2` : | the 3rd component of the 1st vector.
`v3` : | the 1st component of the 2nd vector.
`v4` : | the 2nd component of the 2nd vector.
`v5` : | the 3rd component of the 2nd vector.
`v6` : | the 1st component of the 3rd vector.
`v7` : | the 2nd component of the 3rd vector.
`v8` : | the 3rd component of the 3rd vector.
Returns : | a new PgmMat3x3 instance.

### pgm_mat3x3_new_from_vec3 ()

    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.

`v0` : | the 1st vector.
`v1` : | the 2nd vector.
`v2` : | the 3rd vector.
Returns : | a new PgmMat3x3 instance.

### pgm_mat3x3_new_identity ()

    PgmMat3x3 *         pgm_mat3x3_new_identity             (void);

Creates a new PgmMat3x3 identity matrix.

MT safe.

Returns : | a new PgmMat3x3 instance.

### pgm_mat3x3_copy ()

    PgmMat3x3 *         pgm_mat3x3_copy                     (PgmMat3x3 *mat3x3);

Copies `mat3x3`.

MT safe.

`mat3x3` : | a PgmMat3x3 object.
Returns : | a newly allocated PgmMat3x3.

### pgm_mat3x3_free ()

    void                pgm_mat3x3_free                     (PgmMat3x3 *mat3x3);

Frees all resources used by `mat3x3`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.

### pgm_mat3x3_set_from_scalars ()

    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.

`mat3x3` : | A PgmMat3x3 object.
`v0` : | the 1st component of the 1st vector.
`v1` : | the 2nd component of the 1st vector.
`v2` : | the 3rd component of the 1st vector.
`v3` : | the 1st component of the 2nd vector.
`v4` : | the 2nd component of the 2nd vector.
`v5` : | the 3rd component of the 2nd vector.
`v6` : | the 1st component of the 3rd vector.
`v7` : | the 2nd component of the 3rd vector.
`v8` : | the 3rd component of the 3rd vector.

### pgm_mat3x3_set_from_vec3 ()

    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.

`mat3x3` : | A PgmMat3x3 object.
`v0` : | the 1st vector.
`v1` : | the 1st vector.
`v2` : | the 1st vector.

### pgm_mat3x3_set_from_mat3x3 ()

    void                pgm_mat3x3_set_from_mat3x3          (PgmMat3x3 *mat3x3,
                                                             const PgmMat3x3 *m);

Sets the components of `mat3x3` with the given matrix.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`m` : | A PgmMat3x3 object.

### pgm_mat3x3_is_identity ()

    gboolean            pgm_mat3x3_is_identity              (PgmMat3x3 *mat3x3);

Retrieves whether or not `mat3x3` is the identity matrix.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
Returns : | TRUE if `mat3x3` is the identity matrix, FALSE otherwise.

### pgm_mat3x3_inverse ()

    PgmMat3x3 *         pgm_mat3x3_inverse                  (PgmMat3x3 *mat3x3);

Retrieves the inverted `mat3x3` matrix.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
Returns : | the inverted `mat3x3` in a newly allocated PgmMat3x3.

### pgm_mat3x3_transpose ()

    PgmMat3x3 *         pgm_mat3x3_transpose                (PgmMat3x3 *mat3x3);

Retrieves the transposed `mat3x3` matrix.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
Returns : | the transposed `mat3x3` in a newly allocated PgmMat3x3.

### pgm_mat3x3_add_scalar ()

    PgmMat3x3 *         pgm_mat3x3_add_scalar               (PgmMat3x3 *mat3x3,
                                                             gfloat s);

Computes the sum `mat3x3` + `s`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`s` : | A scalar.
Returns : | the sum `mat3x3` + `s` in a newly allocated PgmMat3x3.

### pgm_mat3x3_add_mat3x3 ()

    PgmMat3x3 *         pgm_mat3x3_add_mat3x3               (PgmMat3x3 *mat3x3,
                                                             const PgmMat3x3 *m);

Computes the sum `mat3x3` + `m`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`m` : | A PgmMat3x3 object.
Returns : | the sum `mat3x3` + `m` in a newly allocated PgmMat3x3.

### pgm_mat3x3_substract_scalar ()

    PgmMat3x3 *         pgm_mat3x3_substract_scalar         (PgmMat3x3 *mat3x3,
                                                             gfloat s);

Computes the substraction `mat3x3` - `s`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`s` : | A scalar.
Returns : | the substraction `mat3x3` - `s` in a newly allocated PgmMat3x3.

### pgm_mat3x3_substract_mat3x3 ()

    PgmMat3x3 *         pgm_mat3x3_substract_mat3x3         (PgmMat3x3 *mat3x3,
                                                             const PgmMat3x3 *m);

Computes the substraction `mat3x3` - `m`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`m` : | A PgmMat3x3 object.
Returns : | the substraction `mat3x3` - `m` in a newly allocated PgmMat3x3.

### pgm_mat3x3_multiply_scalar ()

    PgmMat3x3 *         pgm_mat3x3_multiply_scalar          (PgmMat3x3 *mat3x3,
                                                             gfloat s);

Computes the multiplication `mat3x3` . `s`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`s` : | A scalar.
Returns : | the multiplication `mat3x3` . `s` in a newly allocated PgmMat3x3.

### pgm_mat3x3_multiply_vec3 ()

    PgmVec3 *           pgm_mat3x3_multiply_vec3            (PgmMat3x3 *mat3x3,
                                                             const PgmVec3 *v);

Computes the multiplication `mat3x3` . `v`.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
`v` : | A PgmVec3 object.
Returns : | the multiplication `mat3x3` . `v` in a newly allocated PgmVec3.

### pgm_mat3x3_multiply_mat3x3 ()

    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.

`mat3x3` : | A PgmMat3x3 object.
`m` : | A PgmMat3x3 object.
Returns : | the multiplication `mat3x3` . `m` in a newly allocated PgmMat3x3.

### pgm_mat3x3_to_string ()

    gchar *             pgm_mat3x3_to_string                (PgmMat3x3 *mat3x3);

Converts `mat3x3` to a string representation.

MT safe.

`mat3x3` : | A PgmMat3x3 object.
Returns : | a newly allocated string representing `mat3x3`.

### pgm_mat4x4_new ()

    PgmMat4x4 *         pgm_mat4x4_new                      (void);

Creates a new PgmMat4x4 with components initilized at 0.0f.

MT safe.

Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_from_scalars ()

    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.

`v0` : | the 1st component of the 1st vector.
`v1` : | the 2nd component of the 1st vector.
`v2` : | the 3rd component of the 1st vector.
`v3` : | the 4th component of the 1st vector.
`v4` : | the 1st component of the 2nd vector.
`v5` : | the 2nd component of the 2nd vector.
`v6` : | the 3rd component of the 2nd vector.
`v7` : | the 4th component of the 2nd vector.
`v8` : | the 1st component of the 3rd vector.
`v9` : | the 2nd component of the 3rd vector.
`v10` : | the 3rd component of the 3rd vector.
`v11` : | the 4th component of the 3rd vector.
`v12` : | the 1st component of the 4th vector.
`v13` : | the 2nd component of the 4th vector.
`v14` : | the 3rd component of the 4th vector.
`v15` : | the 4th component of the 4th vector.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_from_vec4 ()

    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.

`v0` : | the 1st vector.
`v1` : | the 2nd vector.
`v2` : | the 3rd vector.
`v3` : | the 4th vector.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_identity ()

    PgmMat4x4 *         pgm_mat4x4_new_identity             (void);

Creates a new PgmMat4x4 identity matrix.

MT safe.

Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_predefined ()

    PgmMat4x4 *         pgm_mat4x4_new_predefined           (PgmMat4x4Predefined predefined);

Creates a new PgmMat4x4 matrix corresponding to `predefined`.

MT safe.

`predefined` : | The predefined 4x4 matrix.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_translate_from_vec3 ()

    PgmMat4x4 *         pgm_mat4x4_new_translate_from_vec3  (const PgmVec3 *t);

Creates a new PgmMat4x4 translation matrix.

MT safe.

`t` : | A PgmVec3 object representing the translation.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_translate_from_scalars ()

    PgmMat4x4 *         pgm_mat4x4_new_translate_from_scalars
                                                            (gfloat tx,
                                                             gfloat ty,
                                                             gfloat tz);

Creates a new PgmMat4x4 translation matrix.

MT safe.

`tx` : | The translation on the x cardinal axis.
`ty` : | The translation on the y cardinal axis.
`tz` : | The translation on the z cardinal axis.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_scale_from_vec3 ()

    PgmMat4x4 *         pgm_mat4x4_new_scale_from_vec3      (const PgmVec3 *s);

Creates a new PgmMat4x4 scaling matrix.

MT safe.

`s` : | A PgmVec3 object representing the scaling.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_scale_from_scalars ()

    PgmMat4x4 *         pgm_mat4x4_new_scale_from_scalars   (gfloat sx,
                                                             gfloat sy,
                                                             gfloat sz);

Creates a new PgmMat4x4 scaling matrix.

MT safe.

`sx` : | The scale on the x cardinal axis.
`sy` : | The scale on the y cardinal axis.
`sz` : | The scale on the z cardinal axis.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_rotate_x ()

    PgmMat4x4 *         pgm_mat4x4_new_rotate_x             (gfloat angle);

Creates a new PgmMat4x4 matrix for a rotation about the x cardinal axis.

MT safe.

`angle` : | The angle of rotation, in radians.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_rotate_y ()

    PgmMat4x4 *         pgm_mat4x4_new_rotate_y             (gfloat angle);

Creates a new PgmMat4x4 matrix for a rotation about the y cardinal axis.

MT safe.

`angle` : | The angle of rotation, in radians.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_rotate_z ()

    PgmMat4x4 *         pgm_mat4x4_new_rotate_z             (gfloat angle);

Creates a new PgmMat4x4 matrix for a rotation about the z cardinal axis.

MT safe.

`angle` : | The angle of rotation, in radians.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_rotate_axis_from_vec3 ()

    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.

`angle` : | The angle of rotation, in radians.
`axis` : | A PgmVec3 object representing the axis of rotation.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_new_rotate_axis_from_scalars ()

    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.

`angle` : | The angle of rotation, in radians.
`axis_x` : | The x component of the axis of rotation.
`axis_y` : | The y component of the axis of rotation.
`axis_z` : | The z component of the axis of rotation.
Returns : | a new PgmMat4x4 instance.

### pgm_mat4x4_copy ()

    PgmMat4x4 *         pgm_mat4x4_copy                     (PgmMat4x4 *mat4x4);

Copies `mat4x4`.

MT safe.

`mat4x4` : | a PgmMat4x4 object.
Returns : | a newly allocated PgmMat4x4.

### pgm_mat4x4_free ()

    void                pgm_mat4x4_free                     (PgmMat4x4 *mat4x4);

Frees all resources used by `mat4x4`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.

### pgm_mat4x4_set_from_scalars ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`v0` : | the 1st component of the 1st vector.
`v1` : | the 2nd component of the 1st vector.
`v2` : | the 3rd component of the 1st vector.
`v3` : | the 4th component of the 1st vector.
`v4` : | the 1st component of the 2nd vector.
`v5` : | the 2nd component of the 2nd vector.
`v6` : | the 3rd component of the 2nd vector.
`v7` : | the 4th component of the 2nd vector.
`v8` : | the 1st component of the 3rd vector.
`v9` : | the 2nd component of the 3rd vector.
`v10` : | the 3rd component of the 3rd vector.
`v11` : | the 4th component of the 3rd vector.
`v12` : | the 1st component of the 4th vector.
`v13` : | the 2nd component of the 4th vector.
`v14` : | the 3rd component of the 4th vector.
`v15` : | the 4th component of the 4th vector.

### pgm_mat4x4_set_from_vec4 ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`v0` : | the 1st vector.
`v1` : | the 2nd vector.
`v2` : | the 3rd vector.
`v3` : | the 4th vector.

### pgm_mat4x4_set_from_mat4x4 ()

    void                pgm_mat4x4_set_from_mat4x4          (PgmMat4x4 *mat4x4,
                                                             const PgmMat4x4 *m);

Sets the components of `mat4x4` with the given matrix.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`m` : | A PgmMat4x4 object.

### pgm_mat4x4_is_identity ()

    gboolean            pgm_mat4x4_is_identity              (PgmMat4x4 *mat4x4);

Retrieves whether or not `mat4x4` is the identity matrix.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
Returns : | TRUE if `mat4x4` is the identity matrix, FALSE otherwise.

### pgm_mat4x4_inverse ()

    PgmMat4x4 *         pgm_mat4x4_inverse                  (PgmMat4x4 *mat4x4);

Retrieves the inverted `mat4x4` matrix.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
Returns : | the inverted `mat4x4` in a newly allocated PgmMat4x4, or NULL if `mat4x4` is non-invertible (singular).

### pgm_mat4x4_transpose ()

    PgmMat4x4 *         pgm_mat4x4_transpose                (PgmMat4x4 *mat4x4);

Retrieves the transposed `mat4x4` matrix.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
Returns : | the transposed `mat4x4` in a newly allocated PgmMat4x4.

### pgm_mat4x4_translate_from_vec3 ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`t` : | A PgmVec3 object representing the translation to apply.

### pgm_mat4x4_translate_from_scalars ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`tx` : | The translation on the x cardinal axis.
`ty` : | The translation on the y cardinal axis.
`tz` : | The translation on the z cardinal axis.

### pgm_mat4x4_scale_from_vec3 ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`s` : | A PgmVec3 object representing the scale to apply.

### pgm_mat4x4_scale_from_scalars ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`sx` : | The scale to apply on the x axis.
`sy` : | The scale to apply on the y axis.
`sz` : | The scale to apply on the z axis.

### pgm_mat4x4_rotate_x ()

    void                pgm_mat4x4_rotate_x                 (PgmMat4x4 *mat4x4,
                                                             gfloat angle);

Post multiplies `mat4x4` by a rotation matrix with the product replacing `mat4x4`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`angle` : | The angle of rotation, in radians.

### pgm_mat4x4_rotate_y ()

    void                pgm_mat4x4_rotate_y                 (PgmMat4x4 *mat4x4,
                                                             gfloat angle);

Post multiplies `mat4x4` by a rotation matrix with the product replacing `mat4x4`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`angle` : | The angle of rotation, in radians.

### pgm_mat4x4_rotate_z ()

    void                pgm_mat4x4_rotate_z                 (PgmMat4x4 *mat4x4,
                                                             gfloat angle);

Post multiplies `mat4x4` by a rotation matrix with the product replacing `mat4x4`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`angle` : | The angle of rotation, in radians.

### pgm_mat4x4_rotate_axis_from_vec3 ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`angle` : | The angle of rotation, in radians.
`axis` : | A PgmVec3 object representing the axis of rotation.

### pgm_mat4x4_rotate_axis_from_scalars ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`angle` : | The angle of rotation, in radians.
`axis_x` : | The x component of the axis of rotation.
`axis_y` : | The y component of the axis of rotation.
`axis_z` : | The z component of the axis of rotation.

### pgm_mat4x4_add_scalar ()

    PgmMat4x4 *         pgm_mat4x4_add_scalar               (PgmMat4x4 *mat4x4,
                                                             gfloat s);

Computes the sum `mat4x4` + `s`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`s` : | A scalar.
Returns : | the sum `mat4x4` + `s` in a newly allocated PgmMat4x4.

### pgm_mat4x4_add_mat4x4 ()

    PgmMat4x4 *         pgm_mat4x4_add_mat4x4               (PgmMat4x4 *mat4x4,
                                                             const PgmMat4x4 *m);

Computes the sum `mat4x4` + `m`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`m` : | A PgmMat4x4 object.
Returns : | the sum `mat4x4` + `m` in a newly allocated PgmMat4x4.

### pgm_mat4x4_substract_scalar ()

    PgmMat4x4 *         pgm_mat4x4_substract_scalar         (PgmMat4x4 *mat4x4,
                                                             gfloat s);

Computes the substraction `mat4x4` - `s`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`s` : | A scalar.
Returns : | the substraction `mat4x4` - `s` in a newly allocated PgmMat4x4.

### pgm_mat4x4_substract_mat4x4 ()

    PgmMat4x4 *         pgm_mat4x4_substract_mat4x4         (PgmMat4x4 *mat4x4,
                                                             const PgmMat4x4 *m);

Computes the substraction `mat4x4` - `m`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`m` : | A PgmMat4x4 object.
Returns : | the substraction `mat4x4` - `m` in a newly allocated PgmMat4x4.

### pgm_mat4x4_multiply_scalar ()

    PgmMat4x4 *         pgm_mat4x4_multiply_scalar          (PgmMat4x4 *mat4x4,
                                                             gfloat s);

Computes the multiplication `mat4x4` . `s`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`s` : | A scalar.
Returns : | the multiplication `mat4x4` . `s` in a newly allocated PgmMat4x4.

### pgm_mat4x4_multiply_vec4 ()

    PgmVec4 *           pgm_mat4x4_multiply_vec4            (PgmMat4x4 *mat4x4,
                                                             const PgmVec4 *v);

Computes the multiplication `mat4x4` . `v`.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
`v` : | A PgmVec4 object.
Returns : | the multiplication `mat4x4` . `v` in a newly allocated PgmVec4.

### pgm_mat4x4_multiply_mat4x4 ()

    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.

`mat4x4` : | A PgmMat4x4 object.
`m` : | A PgmMat4x4 object.
Returns : | the multiplication `mat4x4` . `m` in a newly allocated PgmMat4x4.

### pgm_mat4x4_to_string ()

    gchar *             pgm_mat4x4_to_string                (PgmMat4x4 *mat4x4);

Converts `mat4x4` to a string representation.

MT safe.

`mat4x4` : | A PgmMat4x4 object.
Returns : | a newly allocated string representing `mat4x4`.

### pgm_intersection_line_plane ()

    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.

`l1` : | A PgmVec3 representing a 1st point of the line.
`l2` : | A PgmVec3 representing a 2nd point of the line.
`p` : | A PgmVec3 representing point of the plane.
`pu` : | A PgmVec3 representing a 1st vector colinear to the plane.
`pv` : | A PgmVec3 representing a 2nd vector colinear to the plane.
Returns : | the intersection point in a newly allocated PgmVec3 if any, NULL otherwise.

### pgm_point_belongs_rectangle ()

    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.

`p` : | A PgmVec3 representing the point.
`r` : | A PgmVec3 representing the top-left corner position of the rectangle.
`ru` : | A PgmVec3 representing the top edge of the rectangle.
`rv` : | a 3 components vector defining the left edge of the rectangle.
Returns : | TRUE if `p` belongs to the rectangle, FALSE otherwise.