libg3d Reference Manual | ||||
---|---|---|---|---|
#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);
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);
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
|
x component first vector |
|
y component first vector |
|
z component first vector |
|
x component second vector |
|
y component second vector |
|
z component second vector |
|
x component resulting normal |
|
y component resulting normal |
|
z component resulting normal |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_vector_unify (G3DFloat *nx, G3DFloat *ny, G3DFloat *nz);
Transforms the given vector to the unit vector.
|
x component of vector |
|
y component of vector |
|
z component of vector |
Returns : |
TRUE on success, FALSE else |
gboolean g3d_vector_transform (G3DFloat *x, G3DFloat *y, G3DFloat *z, G3DMatrix *matrix);
Transforms the given vector corresponding to the given matrix
|
x component of vector |
|
y component of vector |
|
z component of vector |
|
transformation matrix (4x4) |
Returns : |
TRUE on success, FALSE else |