Game Development Reference
= x n −
a i x n +
a i x i
a i ( x i −
= x n +
x n )
= x n +
a i v i .
So an affine combination can be thought of as a point plus a linear combination
We represent points and vectors relative to a given coordinate frame. In three
3 , this consists of three linearly independent vectors e 1 , e 2 ,and
e 3 (known as a basis) and a point o (known as an origin). Any vector in this space
can be constructed using a linear combination of the basis vectors:
v = x e 1 + y e 2 + z e 3 .
In practice, we represent a vector in the computer by using the scale factors
( x, y, z ) in an ordered list.
Similarly, we can represent a point as an affine combination of the basis vec-
tors and the origin:
x = o + x e 1 + y e 2 + z e 3 .
Another way to think of this is that we construct a vector and add it to the origin.
This provides a one-to-one mapping between points and vectors.
1.2.2 Magnitude and Distance
As mentioned, one of the quantities of a vector v is its magnitude, represented by
= x 2 + y 2 + z 2 .
We can use this to calculate the distance between two points p 1 and p 2 by taking
p 1 −
dist( p 1 , p 2 )= ( x 1 − x 2 ) 2 +( y 1 − y 2 ) 2 +( z 1 − z 2 ) 2 .
If we scale a vector v by 1 /
, we end up with a vector of magnitude 1, or a
unit vector . This is often represented by v .