## vector

vector — Vector manipulation and calculation

## Functions

gboolean | g3d_vector_normal ()
gboolean | g3d_vector_unify ()
gboolean | g3d_vector_transform ()

## Types and Values

typedef | G3DVector

## Includes

    #include <g3d/vector.h>

## Description

A vector is a one-dimensional array of floating point data.

Declare it as statically as:

G3DVector vector[3];

or allocate it dynamically with:

G3DVector *vector = g3d_vector_new(3, 1);

## Functions

### g3d_vector_normal ()

    gboolean
    g3d_vector_normal (G3DFloat ax,
                       G3DFloat ay,
                       G3DFloat az,
                       G3DFloat bx,
                       G3DFloat by,
                       G3DFloat bz,
                       G3DFloat *nx,
                       G3DFloat *ny,
                       G3DFloat *nz);

calculate the normal from a plane defined by two vectors

#### Parameters

ax | x component first vector |
ay | y component first vector |
az | z component first vector |
bx | x component second vector |
by | y component second vector |
bz | z component second vector |
nx | x component resulting normal |
ny | y component resulting normal |
nz | z component resulting normal |

#### Returns

TRUE on success, FALSE else

### g3d_vector_unify ()

    gboolean
    g3d_vector_unify (G3DFloat *nx,
                      G3DFloat *ny,
                      G3DFloat *nz);

Transforms the given vector to the unit vector.

#### Parameters

nx | x component of vector |
ny | y component of vector |
nz | z component of vector |

#### Returns

TRUE on success, FALSE else

### g3d_vector_transform ()

    gboolean
    g3d_vector_transform (G3DFloat *x,
                          G3DFloat *y,
                          G3DFloat *z,
                          G3DMatrix *matrix);

Transforms the given vector corresponding to the given matrix

#### Parameters

x | x component of vector |
y | y component of vector |
z | z component of vector |
matrix | transformation matrix (4x4) |

#### Returns

TRUE on success, FALSE else

## Types and Values

### G3DVector

    typedef G3DFloat G3DVector;

Vector element type.