vect(3)

NAME
crossVect, unitVect, dotVect -- RCCL 3-vector routines.

USAGE
#include <robotTypes.h>    /* included as part of <rccl.h> */

VECT *crossVect (vr, v1, v2)
  VECT *vr, *v1, *v2;

VECT *unitVect (vr, v1)
  VECT *vr, *v1

float dotVect (v1, v2)
  VECT *v1, *v2;

VECT *addVect (vr, v1 ,v2)
  VECT *vr, *v1, *v2;

VECT *subtractVect (vr, v1 ,v2)
  VECT *vr, *v1, *v2;

VECT *scaleVect (vr, a, v1)
  VECT *vr, *v1;
  float a;

VECT *combineVect (vr, a, v1, b, v2)
  VECT *vr, *v1, *v2;
  float a, b;

float normVect(v1)
  VECT *v1;

VECT *zeroVect(vr)
  VECT *vr;

ARGUMENTS

vr --
    Result vector.

v1, v2 --
    Input vectors.

a, b --
    Input scalars.

DESCRIPTION
crossVect() computes the cross product of two vectors:
        vr = v1 X v2

unitVect() normalizes its input vector:
        vr = v1 / |v1|

dotVect() returns the dot product of two vectors.

addVect() adds two vectors:
        vr = v1 + v2

subtractVect() subtracts two vectors:
        vr = v1 - v2

scaleVect() multiplies a vector by a scalar:
        vr = a v1

combineVect() computes a linear combination of two vectors:
        vr = a v1 + b v2

normVect() returns the 2-norm of a vector.

zeroVect() zeros a vector.

The routines which compute a vector return a pointer to their result parameter vr.

DIAGNOSTICS
unitVect() returns NULL if the input vector is too small to normalize.

NOTES
These routines somewhat parallel the more general floating and double precision vector routines (see addVf(3) and addVd(3)), but are faster because the internal loops have been unrolled.

SEE ALSO
addVd(3), addVf(3).