Defintion from matrix.h

typedef GLfloat Vector[3];


Vectors represent scaled directions in space, and are used whenever a quantity associated with a direction is needed. One potential representation for a vector is as a triple (s,θ,φ) where s is the magnitude and (θ,φ) is the Euler angles of the direction. A more common and useful representation is as (x,y,z), the coordinates of the end of a line extending from the origin in the direction of the vector whose length is equal to the magnitude of the vector.

Allowable Logical Operations

Magnitude of a vector
vector_length(v) computes the magnitude of the vector v
Scalar Product
vector_scalar_product(&v,a) increases the magnitude of v by a factor of a without changing the direction of v
vector_normalize(&v) sets the magnitude of v to 1 without changing the direction of v
Arbitrary Length Setting
vector_set_length(&v, l) sets the magnitude of v to l without changing its direction

Other Notes About Vectors

There are two types of vectors in use 3D geometry and physics: Displacement (or Polar) and Axial. Polar vectors are typically used to refer to the location of things, or the displacement between two points, or the direction of velocities/forces/etc. Axial vectors are typically used in relation to rotation, and typically refer to the direction of the axis of rotation.

The major difference between axial and polar vectors is how they transform with an inverting transformation (i.e. a transformation which converts from a right-handed coordinate system to a left-handed one or vice versa). Polar vectors are inverted with such transforms, axial vectors aren't.

As an example, take an object which at time t=0 is at location r0=(1,0,0) and has a velocity v=(0,1,0). Its position at any future time is r(t) = (1,t,0) and it has a angular momentum of ω = rXv = (0,0,1). Under the coordinate transformation x'=-x, y' = -y, z'=-z, the radial vectors r'0, r'(t), and v' become (-1,0,0), (-1,-t,0), and (0,-1,0) respectively, which physically refers to the same conditions. However, r'Xv' = (0,0,1), which is not what you get by transforming ω (ω' = (0,0,-1)).

Because axial and polar vectors do not transform the same way, it is generally considered a bad idea to add axial and polar vectors together.

Nota bene: As of 24 July 2006, PySoy does not distinguish between axial and polar vectors.