## toolMatrix toolMatrix — Defines basic handlings on matrix. |

## Synopsis

    void                matrix_sphericalToCartesian         (float *cartesian,
                                                             float *spherical);
    void                matrix_productMatrix                (float matRes[3][3],
                                                             float matA[3][3],
                                                             float matB[3][3]);
    void                matrix_cartesianToSpherical         (float *spherical,
                                                             float *cartesian);
    gboolean            matrix_reducePrimitiveVectors       (float reduced[6],
                                                             double full[3][3]);
    void                matrix_productVector                (float vectRes[3],
                                                             float mat[3][3],
                                                             float vect[3]);

## Description

Some very basic linear algebra are redefined here. It also gives access to coordinates conversion, essentially between cartesian and spherical.

## Details

### matrix_sphericalToCartesian ()

    void                matrix_sphericalToCartesian         (float *cartesian,
                                                             float *spherical);

A method to transform spherical coordinates (radius, phi and theta) to cartesian coordinates.

`cartesian` : | an allocated array of 3 floating point values to store the result ;
`spherical` : | an allocated array of 3 floating point values to read the input.

### matrix_productMatrix ()

    void                matrix_productMatrix                (float matRes[3][3],
                                                             float matA[3][3],
                                                             float matB[3][3]);

Compute the mathematical product between `matA` and `matB` and put the result matrix in `matRes`.

`matRes` : | an array of floating point values of size 3x3 ;
`matA` : | an array of floating point values of size 3x3 ;
`matB` : | an array of floating point values of size 3x3.

### matrix_cartesianToSpherical ()

    void                matrix_cartesianToSpherical         (float *spherical,
                                                             float *cartesian);

A method to transform cartesian coordinates in spherical coordinates (radius, phi and theta).

`spherical` : | an allocated array of 3 floating point values to store the result ;
`cartesian` : | an allocated array of 3 floating point values to read the input.

### matrix_reducePrimitiveVectors ()

    gboolean            matrix_reducePrimitiveVectors       (float reduced[6],
                                                             double full[3][3]);

This routine transforms the given matrix `full` into a reduced array used by V_Sim to store box definition.

`reduced` : | a storage for 6 floating point values ;
`full` : | a full 3x3 matrix to be transformed.
Returns : | FALSE if the given matrix is planar.

### matrix_productVector ()

    void                matrix_productVector                (float vectRes[3],
                                                             float mat[3][3],
                                                             float vect[3]);

Compute the mathematical product between `matA` and `vect` and put the result vector in `vectRes`.

`vectRes` : | an array of floating point values of size 3 ;
`mat` : | an array of floating point values of size 3x3 ;
`vect` : | an array of floating point values of size 3.