# 3D transformations by BFDuK5

VIEWS: 7 PAGES: 10

• pg 1
```									  3D transformations

Dr Nicolas Holzschuch
University of Cape Town
e-mail: holzschu@cs.uct.ac.za
Modified by Longin Jan Latecki
latecki@temple.edu
Sep. 11, 2002
Map of the lecture
• Homogeneous coordinates in 3D
• Geometric transformations in 3D
– translations, rotations, scaling,…
Homogeneous coordinates in 3D
• In order to model all transformations as
matrices:                              x 
– introduce a fourth coordinate, w         y 
 
– two vectors are equal if:                z 
x/w = x’/w’, y/w = y’/w’ and z/w=z’/w’    
 
w
• All transformations are 4x4 matrices
Translations in 3D

1   0   0 t x 

0   1   0 t y 
T (t x ,t y ,t z )               

0   0   1 t z 
       0 1 

0   0         

x   x  wt x
y   y  wt


y

z  z  wt z
w  w

Scaling in 3D
 x
s     0    0    0 
0    sy   0    0 
S(sx , sy ,sz )                   
0    0    sz   0 
0              1 
     0    0      

x   s x x
y   s y


y

z   sz z
w  w

Rotations in 3D
• One rotation: one axis and one angle
• Matrix depends on both axis and angle
– direct expression possible, from axis and
angle, using cross-products
• Rotations about axis have simple
expression
– other rotations express as composition of
these rotations
Rotation around x-axis

1   0        0      0
 cos 
0          sin    0    x-axis is
Rx (  )                         unmodified
 sin 
0         cos      0
                   1

0   0        0       


1   0   0    0
       1   0
Sanity check: a rotation of p/2                  0   0
Rx ( 2 )  
p                    
should change y in z, and z in -y               
0   1   0    0
            1

0   0   0     
Rotation around y-axis
cos     0 sin    0
 0       1   0     0    y-axis is
Ry ( )                         unmodified
 sin 
         0 cos    0
 0                 1
         0   0      

0   0   1 0
0       0 0
Sanity check: a rotation of p/2                       1
Ry ( p )              
should change z in x, and x in -z         2
1
    0   0 0
0       0 1 
    0       
 
cos    sin    0   0 
 
sin   cos      0   0     z-axis is
Rz ( )                          unmodified
 0      0      1   0 
 0                 1 
        0      0     


0   1   0   0 
            0 
Sanity check: a rotation of p/2           p
1

0    0

Rz ( 2 ) 
should change x in y, and y in -x                
0   0    1   0 
            1 

0   0    0     
Any transformation in 3D
• All transformations in 3D can be
expressed as combinations of
translations, rotations, scaling
– expressed using matrix multiplication
• Transformations can be expressed as
4x4 matrices

```
To top