You are on page 1of 24

Three - Dimensional

Transformation
Three - Dimensional Transformation…

 Necessary to manipulate, viewing, and


construction of 3D graphic images.
 Matrix Multiplication or Concatenation is
used.

2
3D Point
 We will consider points as column
vectors. Thus, a typical point with
coordinates (x, y, z) is represented as:

x
 
 y
z 
 
3D Point
 A 3D point Pwith coordinates (x, y, z) is represented as in
homogenous system:

x
 
 y
P 
z
 
1 
 
3D Transformation
 3D transformations are represented by 4×4
matrixes in homogenous form:

a b c tx 
d e f 
ty 

g h i tz 
 
0 0 0 1
Three - Dimensional
Transformation
 Manipulation, viewing and construction of three-dimensional
graphic images requires the use of three dimensional
geometric and coordinate transformations.
 These transformations are formed by composing the basic
transformations of translation, scaling and rotation.
 Each of these transformations can be represented as a
matrix transformation.
 Transformations are now represented as 4x4 matrices
 Geometric transformations
 Coordinate transformations
 Composite transformations
 Instance transformations

6
Three - Dimensional
Transformation
 Very similar to 2D transformation

 Scaling transformation
 x   s x 0 0 0  x 
    
 y   0 s y 0 0  y 
 z    0 0 s 0  z 
   z
 
1 0 0 0 1  1 
  

7
Geometric transformations
• Object moves
• Coordinate system remains stationary
• Basic transformations are translation, scaling and rotation.

 Translation
V V  D
 Scaling
V   SV
 Rotation

V   RV
Translation
p ' ( x' , y ' , z ' )
◦ The amount of the translation is added to or z
subtracted from the x, y, and z coordinates
◦ In general, this is done with the equations:

x   x  Tx p ( x, y , z )
y   y  Ty v
z   z  Tz y
◦ This can also be done with the matrix
multiplication:

 x' 1 0 0 Tx   x 
x
 y ' 0 1 0 Ty   y 
 
 z '  0 0 1 Tz   z 
    
 1  0 0 0 1  1 
Scaling
 In general, this is done with the equations:
x n = sx * x
yn = sy * y
zn = sz * z
 This can also be done with the matrix multiplication:

 xn   s x 0 0 0  x 
y   0 sy 0 0  y 
 n   *
 zn   0 0 sz 0  z 
     
 1  0 0 0 1  1 

III-
10
Scaling
 Scaling

V   SV
 x'  S x 0 0 0  x  x   x  Sx
 y '  0 0  y 
y   y  Sy
  Sy 0
 z'  0 0 Sz 0  z 
    
1  0 0 0 1  1  z   z  Sz
Rotation
 3D rotation is done around a rotation
axis
 Fundamental rotations – rotate about x, y,
or z axes
 Counter-clockwise rotation is referred to
as positive rotation .
y

+ x
z
12
Rotation
• The matrix form for rotation

– x axis – y axis

 x  1 0 0 0  x   xn   cos 0 sin  0  x 
 y  0 cos 0  y  y  0
 n    sin 
  1 0 0  y 
* *
 zn  0 sin  cos 0  z   zn   sin  0 cos 0  z 
           
 1  0 0 0 1  1  1  0 0 0 1  1 

– z axis
 xn  cos  sin  0 0  x 
x  x cos  y sin 
 y   sin  cos 0 0  y 
 n   * y  x sin   y cos
z  0 0 1 0  z 
      z  z
1  0 0 0 1  1 
13
Rotation
 Rotation about z – similar to 2D rotation
x'  x cos  y sin 
y '  x sin   y cos
z'  z

 x   cos  sin  0 0  x  y
    
 y   sin  cos 0 0  y 
 z    0 0 1 0  z 
     + x
1  0 1  1 
   0 0 z
14
Rotation
 Rotation about y:

z '  z cos   x sin 


x'  z sin   x cos 
y'  y

 x   cos  0 sin  0  x 
    
 y   0 1 0 0  y 
 z     sin  0 cos  0  z 
    
1  0 1  1 
   0 0

15
Rotation
 Rotation about x:

y '  y cos  z sin 


z '  y sin   z cos
x'  x

 x   1 0 0 0  x 
    
 y   0 cos  sin  0  y 
 z    0 sin  cos 0  z 
    
 1  0 1  1 
   0 0

16
17
3D Reflections
About a plane:
 A reflection through the xy plane:
 x  1 0 0 0  x 
 y  0 1 0 0  y 
   
  z  0 0 1 0  z 
     
 1  0 0 0 1  1 

 A reflections through the xz and the


yz planes are defined similarly.
Reflection
• Reflection through the xy-plane:

• Reflection through the yz-plane:

• Reflection through the xz-plane:

III-
19
3D Coordinate Transformation
 Moving the observer who views the
object
 Keeping the object stationary

20
3D Coordinate Transformation

x  x  Tx
y  y  Ty
z  z  Tz

21
Composite 3D Transformation
 Equivalent to matrix multiplication or concatenation.
 A series of transformations on an object can be
applied as a series of matrix multiplications.

22
Composition of transformations
 ax   px 
   
Rotate q degrees about axis a =  a y  through point p  p y 
   
 az   pz 
Composite 3D Transformation
 Scaling can be done relative to the object center
with a composite transformation
 Scaling an object centered at (cx, cy, cz) is done with
the matrix multiplication:
 xn  1 0 0 c x  s x 0 0 0  1 0 0  cx   x 
 y  0 1 0 c y   0 sy 0 0 0 1 0  c y   y 
 n   * * *
 zn  0 0 1 cz   0 0 sz 0 0 0 1  cz   z 
         
 w  0 0 0 1 0 0 0 1 0 0 0 1  w 

III-
24

You might also like