SLIDE 3D Transformation Notes
Contents
Transformations in 3D
Type 
Column Vector Matrix 
Row Vector Matrix 
Properties 
Translation
translate (t_{x} t_{y} t_{z})

1  0  0  t_{x} 
0  1  0  t_{y} 
0  0  1  t_{z} 
0  0  0  1 

1  0  0  0 
0  1  0  0 
0  0  1  0 
t_{x}  t_{y}  t_{z}  1 

Rigid Body
Orthogonal Submatrix

Scale
scale (s_{x} s_{y} s_{y})

s_{x}  0  0  0 
0  s_{y}  0  0 
0  0  s_{z}  0 
0  0  0  1 

s_{x}  0  0  0 
0  s_{y}  0  0 
0  0  s_{z}  0 
0  0  0  1 

Nonrigid Body

Rotation around X
rotate (1 0 0) (a)

1  0  0  0 
0  cos(a)  sin(a)  0 
0  sin(a)  cos(a)  0 
0  0  0  1 

1  0  0  0 
0  cos(a)  sin(a)  0 
0  sin(a)  cos(a)  0 
0  0  0  1 

Rigid Body
Orthogonal

Rotation around Y
rotate (0 1 0) (a)

cos(a)  0  sin(a)  0 
0  1  0  0 
sin(a)  0  cos(a)  0 
0  0  0  1 

cos(a)  0  sin(a)  0 
0  1  0  0 
sin(a)  0  cos(a)  0 
0  0  0  1 

Rigid Body
Orthogonal

Rotation around Z
rotate (0 0 1) (a)

cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 

cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 

Rigid Body
Orthogonal

Rotation around an Unit Axis
rotate (x y z) (a)

w = [x, y, z, 0]
W = CrossProduct(w)
R = I + W sin(a) + W^{2} (1  cos(a))

w = [x, y, z, 0]
W = CrossProduct(w)
R = I + W sin(a) + W^{2} (1  cos(a))

Rigid Body
Orthogonal

Create Cross Product Matrix
w is a unit vector
W = CrossProduct(w )
b = w * a = W a

0  w_{z}  w_{y}   0 
w_{z}  0  w_{x}  0 
w_{y}  w_{x}  0  0 
0  0  0  0 

0  w_{z}  w_{y}   0 
w_{z}  0  w_{x}  0 
w_{y}  w_{x}  0  0 
0  0  0  0 

Skew Symmetric
W^{3} = W

Shear XY
[x, y, z, 1] =>
[x + sh_{x}*z, y + sh_{y}*z, z, 1]

1  0  sh_{x}  0 
0  1  sh_{y}  0 
0  0  1  0 
0  0  0  1 

1  0  0  0 
0  1  0  0 
sh_{x}  sh_{y}  1  0 
0  0  0  1 

Nonrigid Body

Shear XZ
[x, y, z, 1] =>
[x + sh_{x}*y, y, z + sh_{z}*y, 1]

1  sh_{x}  0  0 
0  1  0  0 
0  sh_{z}  1  0 
0  0  0  1 

1  0  0  0 
sh_{x}  1  sh_{z}  0 
0  0  1  0 
0  0  0  1 

Nonrigid Body

Shear YZ
[x, y, z, 1] =>
[x, y + sh_{y}*x, z + sh_{z}*x, 1]

1  0  0  0 
sh_{y}  1  0  0 
sh_{z}  0  1  0 
0  0  0  1 

1  sh_{y}  sh_{z}  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 

Nonrigid Body

Change of Basis
Compute G^{A<B} or G^{B>A}
Given BO^{A}, BX^{A}, BY^{A}, and BZ^{A}
(the origin and orthonormal basis vectors of the B coordinate system expressed
with respect to A's coordinate system)

BX^{A}_{x}  BY^{A}_{x}  BZ^{A}_{x}  BO^{A}_{x} 
BX^{A}_{y}  BY^{A}_{y}  BZ^{A}_{y}  BO^{A}_{y} 
BX^{A}_{z}  BY^{A}_{z}  BZ^{A}_{z}  BO^{A}_{z} 
0  0  0  1 

BX^{A}_{x}  BX^{A}_{y}  BX^{A}_{z}  0 
BY^{A}_{x}  BY^{A}_{y}  BY^{A}_{z}  0 
BZ^{A}_{x}  BZ^{A}_{y}  BZ^{A}_{z}  0 
BO^{A}_{x}  BO^{A}_{y}  BO^{A}_{z}  1 

Rigid Body

The standard camera placement transformation is represented in
SLIDE by the
lookat
transformation.
Although the most common use for this transformation is to place a
camera at one point in space looking at another point in space,
it can also be used to place any object or light in the scene.
The lookat transformation is particularly useful for pointing a
spotlight at something in the scene.
The lookat transformation specifies a new coordinate system,
(u,v,n) within the current system by
 the origin of the new system (eye),
 a point that will lie on the naxis (vrp),
 and an up vector that should project onto the vaxis in the
uvplane (up).
In order to compute the transformation matrix for the lookat
transform, we must first find the orthonormal coordinate axes
(u,v,n) and the origin c.
 c = eye
 n = c  vrp / c  vrp
 u = up x n / up x n
 v = n x u
If the up vector is parallel to the vector between the
eye and the vrp, then the u and v axes
will be degenerate. In this case, do whatever you like with
u and v, so long as (u,v,n) is orthonormal, since
the operation is not well defined.
Now that we have the necessary information: the origin, c, and
the coordinate axes, (u,v,n), we can compute the lookat
transformation, Q_{lookat}.
The matrix, Q_{lookat}, will transform points in the
camera's or object's system into the world system just like any other
modeling transform.
Let's call
p_{uvn}=(p_{u} p_{v} p_{n})
and
p_{xyz}=(p_{x} p_{y} p_{z})
p_{xyz}=Q_{lookat}p_{uvn}
p_{xyz}=
c +
(p_{u}u + p_{v}v + p_{n}n)
p_{xyz}
= T(c) Q_{xyz<uvn} p_{uvn}
= T(c)

u_{x}  v_{x}  n_{x}  0 
u_{y}  v_{y}  n_{y}  0 
u_{z}  v_{z}  n_{z}  0 
0  0  0  1 



Note that Q_{xyz<uvn} is an orthogonal matrix
(Q_{xyz<uvn}^{1}=Q_{xyz<uvn}^{T}).
So it is easy to find
Q_{uvn<xyz}=Q_{xyz<uvn}^{1}.
so we get
Q_{lookat}
= T(c) Q_{xyz<uvn}
where
Q_{xyz<uvn} =

u_{x}  v_{x}  n_{x}  0 
u_{y}  v_{y}  n_{y}  0 
u_{z}  v_{z}  n_{z}  0 
0  0  0  1 


and Q_{uvn<xyz} =

u_{x}  u_{y}  u_{z}  0 
v_{x}  v_{y}  v_{z}  0 
n_{x}  n_{y}  n_{z}  0 
0  0  0  1 


We also need to find Q_{lookat}^{1}, which we
can do in a straightforward fashion:
Q_{lookat}^{1}
= (T(c)
Q_{xyz<uvn})^{1}
= Q_{xyz<uvn}^{1} T(c)
^{1}
= Q_{xyz<uvn}^{T} T(c)
^{1}
= Q_{uvn<xyz} T(c)
Representing a Rotation as Three Shears
A rotation around the zaxis by an angle a
can be represented by the following column vector matrix:
R_{z}(a) 
= 
cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 



This same rotation can also be represented by a string of three
shear operations:
R_{z}(a) = SH_{x along y}( tan(a/2) ) * SH_{y along x}( sin(a) ) * SH_{x along y}( tan(a/2) )
The following is the same equation written out with column vector
matrices:
R_{z}(a) 
= 
cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 


 = 
1  tan(a/2)  0  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 



1  0  0  0 
sin(a)  1  0  0 
0  0  1  0 
0  0  0  1 



1  tan(a/2)  0  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 



Representing a Shear as Rotate, Scale, Rotate, Scale
A shear of the x coordinate while moving along the
yaxis can be represented by the following column vector
matrix:
SH_{x along y}( sh_{x} ) 
= 
1  sh_{x}  0  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 



This same shear can also be represented by a string of a rotation, a nonuniform scaling, a rotation, and a nonuniform scaling:
SH_{x along y}( sh_{x} ) = S( s_{x}, s_{y}, 1 ) * R_{z}( b ) * S( 1, s, 1 ) * R_{z}( a )
SH_{x along y}( sh_{x} ) = S( s_{x}, s_{y}, 1 ) * R_{z}( b ) * S( 1, s, 1 ) * R_{z}( a )
Where sh_{x} >= 0 and the other parameters follow these
equations:
s = sqrt( ( 1 + sh_{x} ) * ( 1 + sh_{x} + sh_{x}^{2} ) ) 
b = atan( sqrt( 
1 + sh_{x} + sh_{x}^{2}
1 + sh_{x}


) ) 
s_{y} = sqrt( 
1
1 + sh_{x} + sh_{x}^{2}


) 
The following is the same equation written out with column vector
matrices:
SH_{x along y}( sh_{x} ) 
= 
1  sh_{x}  0  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 


 = 
s_{x}  0  0  0 
0  s_{y}  0  0 
0  0  1  0 
0  0  0  1 



cos(b)  sin(b)  0  0 
sin(b)  cos(b)  0  0 
0  0  1  0 
0  0  0  1 



1  0  0  0 
0  s  0  0 
0  0  1  0 
0  0  0  1 



cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 



SH_{x along y}( sh_{x} ) 
= 
1  sh_{x}  0  0 
0  1  0  0 
0  0  1  0 
0  0  0  1 


 = 
s_{x}  0  0  0 
0  s_{y}  0  0 
0  0  1  0 
0  0  0  1 



cos(b)  sin(b)  0  0 
sin(b)  cos(b)  0  0 
0  0  1  0 
0  0  0  1 



1  0  0  0 
0  s  0  0 
0  0  1  0 
0  0  0  1 



cos(a)  sin(a)  0  0 
sin(a)  cos(a)  0  0 
0  0  1  0 
0  0  0  1 



This page was originally built by Jordan Smith.
Last modified: Thursday, 24Oct2002 10:38:16 PDT