In generating animated flying sequences, we require the viewpoint to move around the scene. Let the required viewpoing be , and let the required view direction be .
We can transform coordinates into a coordinate system centered at the viewpoint, looking in the positive -direction. To do this we must:
Translate about the origin, .
Rotate about the -axis until is in the -plane. To do this, define and , . Then the rotation matrix is:
Rotate about the -axis until points along the -axis. To do this, define and , . Then the rotation matrix is:
These can then be combined into a single tranformation . For every point scene, we calculate . The view is now in canonical form and we can apply projection.
About a general line, we can first rotate the general line to align it with the -axis, then rotate, and then rotate back: .
We can do similar effects (such as shrinking an object in-place) as .
2. Projection Matrices
For canonical orthographic projection we drop the -coordinate: such that .
For canonical perspective projection we do: such that . We can normalize this to get .
All projection matrices are singular, or non-invertible. Given a 2D image, we cannot in general reconstruct the 3D scene.
3. Transformation Matrices
Homogeneous coordinates fall into two types:
Position Vectors with a non-zero final ordinate . This can be normalized to Cartesian form.
Direction Vectors have a zero final ordinate . These have direction & magnitude.
If we add two direction vectors, we get another direction vector.
If we add a position vector and a direction vector, we get another position vector.
If we add two position vectors, we obtain their midpoint. This is reasonable, as adding two position vectors has no real meaning in vector geometry.
In a transformation matrix, the bottom row is always . Hence, the columns comprise of three direction vectors and one position vector.
If we transform a direction vector, its only affected by the first three columns.
If we transform a position vector, its affected by all four columns.
If we do not shear the object, then , and remain orthogonal, i.e. .
The columns of the transformation matrix represent the columns of a new coordinate system in terms of the old coordinate system:
is the transformed -axis.
is the transformed -axis.
is the transformed -axis.
is the new origin.
4. Dot Product as Projection
The dot product is defined as , where is the angle between and . If is along a cooridnate axis then is the ordinate of in the direction of . Hence, we can see the dot product can be used to express a projection, where is a unit direction vector.
Hence, we can conclude that to transform into coordinates, we can use tehe matrix:
Now, we can control the vertical, for example by constraining to point upwards.
To solve the flying sequence problem, we can define:
as is the view direction.
where is some vector in the horizontal direction (i.e. ).
where is some vector with a positive component (i.e. ).
To find the 4 unknowns, , , and , we can use the orthogonality conditions , so . Since , we have: