3-Dimensional Linear and Affine Transformations

 

 

Dot product:

 

                        a × b = a1b1  +   a2b2 +  a3b3 =   ||a|| ||b|| cos a

 

 

 

Cross product:

 

a x b = = (a2b3 – a3b2, a3b1 – a1b3, a1b2 – a2b1)

 

 

Magnitude is:              || a x b || = ||a|| ||b|| sin a

 

 

3-D Transformations

 

Note: in OpenGL a matrix is represented as a 4 * 4 matrix of single- or double-precision floating-point values stored in column-major order. That is, the matrix is stored as

 

Sorry -- no description available

 

 

1.   Translation by a vector  u = :

 

 

 


2.   Scaling by      along the  x-, y-, and z- axis, respectively:

 

 

 

 

 

3.   Reflection is a special case of scaling with negative coefficients:  or  or . This achieves reflection about the coordinates planes. Need to be combined with translations and rotations for the general plane. E.g. reflection about the xz – plane (bottom plane) is

 

 

 

 

4.   Projection:  a projection P renders an object to a lower dimension. They are always idempotent: P 2 = P .

 

Simplest case: projection to the coordinate planes. This is scaling with a coefficient being 0, the rest 1. E.g. projection to the xz – plane (bottom plane):

 

 


A perspective projection is from a single point. Simplest case: shadow cast on the bottom xz-plane.

 

 

The matrix is

 

                            

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Here  x maps to x’ = ,  y  maps  to  0  and  z  maps  to  z’ =   by the similarity of the appropriate triangles.

 

 

 

General projection: first we need the equations of the line and the plane.

 

 

Equation of line:                                 Ax + By + C = 0

 

Equation of plane:                              Ax + By + Cz + D = 0

 

 

These are easily proved using normal vectors n = (A, B) and n = (A, B, C), respectively, setting the dot products to 0 on a difference vector (2 vectors), respectively.

 


General projection to the plane     Ax + By + Cz + D = 0:

 

 

 

 

Here the (x, y, z) is the vector between the light source and the center of the object.

 

 

 

5.   Rotation: The rotation Rq , u by the agle q  about the unit vector  u = (x, y, z)  is

 

 

where    s = sin q    and   c = cos q . Also || u || = || (x, y, z) || = 1.