0% found this document useful (0 votes)
23 views37 pages

3D Transformations PPT

Uploaded by

Mir 69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views37 pages

3D Transformations PPT

Uploaded by

Mir 69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Prof.

Sonal Shroff
Computer Engg Dept
TSEC
 Three dimensional graphics is useful in
the representation of realistic objects as
well as in animation.
 3D display techniques
 3D transformations
 3D representations
 3D viewing
 3D clipping

Prof. Sonal Shroff - TSEC 2


 Right handed system

Prof. Sonal Shroff - TSEC 3


 Left handed system

Prof. Sonal Shroff - TSEC 4


 Translations
 Scaling
• Scaling wrt origin
• Scaling wrt any fixed position
 Rotation
• Rotation about any coordinate axis
• Rotation about an axis parallel to any one of the
coordinate axes
• Rotation about an arbitrary axis not parallel to any one
of the coordinate axes
 Reflection
 Shear

Prof. Sonal Shroff - TSEC 5


x'  x  t x
y y'  y  t y
z'  z  tz

 x' 1 0 0 tx   x
( x' , y ' , z ' )  y ' 0 1 0 t y   y 
( x, y, z )   .
 z '  0 0 1 tz   z 
z x     
 1  0 0 0 1  1 

Prof. Sonal Shroff - TSEC 6


 In order to perform a rotation of an object, an
axis of rotation and the amount of angular
rotation is to be specified.
 The rotation axis can have any spatial
orientation.
 The rotation is classified as
• Rotation about any one of the coordinate axes
• Rotation about an axis parallel to any one of the
coordinate axes
• Rotation about an arbitrary axis not parallel to any one
of the coordinate axes

Prof. Sonal Shroff - TSEC 7


 Rotation about any one of the coordinate axes

Prof. Sonal Shroff - TSEC 8


 3D Z axis rotation

x'  x cos   y sin 


y '  x sin   y cos 
z'  z  cos  sin  0 0
 sin  cos  0 0

 0 0 1 0
 
 0 0 0 1

Prof. Sonal Shroff - TSEC 9


 3D X axis rotation

y '  y cos   z sin 


z '  y sin   z cos 
x'  x 1 0 0 0
0 cos  sin  0

0  sin  cos  0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 10


 3D Y axis rotation

z '  z cos   x sin 


x'  z sin   x cos 
y'  y cos  0  sin  0
 0 1 0 0

 sin  0 cos  0
 
 0 0 0 1

Prof. Sonal Shroff - TSEC 11


 Rotation about an axis parallel to any one of
the coordinate axes

Prof. Sonal Shroff - TSEC 12


 Rotation about an axis parallel to any one of
the coordinate axes

Prof. Sonal Shroff - TSEC 13


 Rotation about an axis not parallel to any one
of the coordinate axes
1) Translate the object along with the rotation axis so
that the rotation axis passes through the coordinate
origin
2) Rotate the object so that the axis of rotation
coincides with any one of the coordinate axes
3) Perform the specified rotation
4) Apply reverse rotation so that the rotation axis goes
back to its original orientation
5) Apply reverse translation so that the rotation axis
goes back to its original position

Prof. Sonal Shroff - TSEC 14


 Rotation about an axis not parallel to any one
of the coordinate axes

Prof. Sonal Shroff - TSEC 15


The two points are P1 x1 , y1 , z1  and P2 x 2 , y2 , z2 
 vector V  ( x 2 - x1 , y2  y1 , z 2  z1 )
which is used to define unit vector u in the direction of rotation axis
 u  V / V  (a, b, c)
where a  x / V , b  y / V , c  z / V

Prof. Sonal Shroff - TSEC 16


y y y
P2
P2
P1
P1 P1
x x x
P2
z z z

y y y
P2 P2

P1 P1 P1

P2 x x x

z z z

Prof. Sonal Shroff - TSEC 17


1) Translate the object along with the rotation
axis so that the rotation axis passes through
the coordinate origin

 1 0 0 0
 0 1 0 0
T 
 0 0 1 0
 
 x1  y1  z1 1

 This makes point P1 to coincide with the origin

Prof. Sonal Shroff - TSEC 18


2) To make rotation axis coincide with Z axis
• Rotate rotation axis (vector u) about X axis so that it
is in XZ plane

Prof. Sonal Shroff - TSEC 19


2) To make rotation axis coincide with Z axis
• Rotate rotation axis (vector u) about Y axis so that it
coincides with Z axis

Prof. Sonal Shroff - TSEC 20


 Rotate rotation axis (vector u) about X axis so
that it is in XZ plane - This is accomplished by
rotating the projection of u on the YZ plane
onto the Z axis

Prof. Sonal Shroff - TSEC 21


 .

u '.u z  u ' u z cos 1


 cos 1  u '.u z / u ' u z  c / d
where d  (b 2  c 2 )
u 'u z  u x u ' u z sin 1
using cartesian expression for the cross product,
u 'u z  u x b
 sin 1  b / d

Prof. Sonal Shroff - TSEC 22


 Thus the rotation matrix for rotating a rotation
axis about X axis is

1 0 0 0
0 c / d b/d 0
Rx (1 )  
0 b / d c/d 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 23


 Rotate rotation axis (vector u) about Y axis so
that it coincides with Z axis – This is
accomplished by rotating the vector u” about Y
axis such that it aligns with uz.

Prof. Sonal Shroff - TSEC 24


 .
u".u z  u" u z cos 2
 cos 2  u".u z / u" u z  d
using the equations for cross product,
u"u z  u y u" u z sin 2
and u"u z  u y (a )
 sin 2  a

Prof. Sonal Shroff - TSEC 25


 Thus the rotation matrix for rotation about Y
axis is

d 0 a 0
0 1 0 0
R y (2 )  
 a 0 d 0
 
0 0 0 1

 Now the rotation axis is aligned with positive Z


axis

Prof. Sonal Shroff - TSEC 26


3) Perform rotation about Z axis with specified
angle θ
• The rotation matrix is

 cos  sin  0 0
 sin  cos  0 0
Rz ( )  
 0 0 1 0
 
 0 0 0 1

Prof. Sonal Shroff - TSEC 27


4) Apply reverse rotation so that the rotation axis
goes back to its original orientation
5) Apply reverse translation so that the rotation
axis goes back to its original position

 Thus the rotation about any arbitrary axis is


done with these transformation,
1 1
R( )  T .Rx (1 ).Ry (2 ).Rz ( ).Ry (2 ).Rx (1 ).T 1

Prof. Sonal Shroff - TSEC 28


y y
x'  x.S x
y '  y.S y
z '  z.S z

z z
x x
 x'  S x 0 0 0  x 
 y '  0 Sy 0 0  y 
P'      .  S .P
 z'  0 0 Sz 0  z 
    
1  0 0 0 1  1 
Prof. Sonal Shroff - TSEC 29
y y y

z (x f , y f , z f ) (x f , y f , z f ) (x f , y f , z f )
x z x z x
y
S x 0 0 (1  S x ) x f 
0 Sy 0 (1  S y ) y f 
T  S  T 1  
(x f , y f , z f ) 0 0 Sz (1  S z ) z f 
z  
x 0 0 0 1 

Prof. Sonal Shroff - TSEC 30


 The reflection relative to XY plane (about Z axis)

1 0 0 0
0 1 0 0
RFz  
0 0 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 31


 The reflection relative to YZ plane (about X axis)

 1 0 0 0
0 1 0 0
RFx  
0 0 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 32


 The reflection relative to XZ plane (about Y axis)

1 0 0 0
0 1 0 0
RFy  
0 0 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 33


 Shearing about Z axis is

1 0 0 0
0 1 0 0

a b 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 34


 Shearing about X axis is

1 a b 0
0 1 0 0

0 0 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 35


 Shearing about Y axis is

1 0 0 0
a 1 b 0

0 0 1 0
 
0 0 0 1

Prof. Sonal Shroff - TSEC 36


Prof. Sonal Shroff - TSEC 37

You might also like