
9.4 Implementing the Mathematics 193
data[9] = 2*q.j*q.k - 2*q.i*q.r;
data[10] = 1 - (2*q.i*q.i + 2*q.j*q.j);
data[11] = pos.z;
}
};
9.4.5 Transforming Vectors
In Section 9.1.3, we looked at finding the position of part of an object, even when the
object had been moved and rotated. This is a conversion between object coordinates
(i.e., the position of the part relative to the origin of the object and its axes) and world
coordinates (its position relative to the global origin and ax es directions).
This conv ersion can be performed by multiplying the local coordinates by the
object’s transform matrix. The transform matrix, in turn, can be generated from ...