vector3LIBG3D LibraryvectorVector manipulation and calculationSynopsis
#include <g3d/vector.h>
typedef G3DVector;
gboolean g3d_vector_normal (G3DFloat ax,
G3DFloat ay,
G3DFloat az,
G3DFloat bx,
G3DFloat by,
G3DFloat bz,
G3DFloat *nx,
G3DFloat *ny,
G3DFloat *nz);
gboolean g3d_vector_unify (G3DFloat *nx,
G3DFloat *ny,
G3DFloat *nz);
gboolean g3d_vector_transform (G3DFloat *x,
G3DFloat *y,
G3DFloat *z,
G3DMatrix *matrix);
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);DetailsG3DVectorG3DVectortypedef G3DFloat G3DVector;
Vector element type.g3d_vector_normal ()g3d_vector_normalgboolean 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 vectorsax : 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 ()g3d_vector_unifygboolean g3d_vector_unify (G3DFloat *nx,
G3DFloat *ny,
G3DFloat *nz);
Transforms the given vector to the unit vector.nx : x component of vector
ny : y component of vector
nz : z component of vector
Returns : TRUE on success, FALSE else
g3d_vector_transform ()g3d_vector_transformgboolean g3d_vector_transform (G3DFloat *x,
G3DFloat *y,
G3DFloat *z,
G3DMatrix *matrix);
Transforms the given vector corresponding to the given matrixx : x component of vector
y : y component of vector
z : z component of vector
matrix : transformation matrix (4x4)
Returns : TRUE on success, FALSE else