You are on page 1of 42

Subject - Computer Graphics

(22318)
Unit 3 (Topic 4)

- By Nitin Pawar Sir


U–3 Overview of Transformations
 3.1 2D Transformations
 3.2 Matrix representations &
Homogeneous co-ordinates
 3.3 Composite Transformations
 3.4 3D Transformations
 3.5 Types of Projections
3.4 3D Transformations
 In 3D geometric transformations and object modelling are
extended from 2D to methods by including z co-ordinate.
 Basic transformations in 3D are,
 Translation
 Scaling
 Rotation

 Here 3D homogeneous coordinates, required 4 co-ordinates.


 A point is represented by [x, y, z, h] i.e. h=1 unit
3D Transformations.
 Use homogeneous coordinates, just as in 2D case.
 Transformations are now 4x4 matrices.
 We will use a right-handed (world) coordinate system - ( z
out of page ).

Note:
Convenient to think of display as
Being left-handed !!
( z into the screen )
x
z (out of page)
Transformations Matrix for 3D Translation….
Transformations Matrix for 3D Scaling….
Rotation in 3D
 Need to specify which axis the rotation is about.
 z-axis rotation is the same as the 2D case.

cos − sin  0 0
 sin  cos 0 0
R z ( ) = 
 0 0 1 0
 
 0 0 0 1
y ' = y cos − z sin 
z ' = y sin  + z cos
x' = x

z' = z cos − x sin


x' = z sin + x cos
y' = y

x' = x cos − y sin 


y ' = x sin  + y cos
z' = z
3D Rotation about Arbitrary Axis
Case 1: Rotation of an object about axis that is parallel to one of
the co-ordinate axis. See below transformation sequence,
(Ex. around an axis parallel to x-axis)
Case 1....
 Rotation about an Axis that is Parallel to One of the
Coordinate Axes
◦ Translate the object so that the rotation axis
coincides with the parallel coordinate axis
◦ Perform the specified rotation about that axis
◦ Translate the object so that the rotation axis is
moved back to its original position
Case 1….

P ' = T −1 • Rz ( ) • T • P
Y Y

 P2 P2

P1 P1

X X

Z Z
3D Rotation about Arbitrary Axis
Case 2: Rotation of an object about axis that is not parallel to one of
the co-ordinate axis. See below transformation sequence,
(Ex. Rotation about arbitrary axis)
Case 2….
 Rotation about an Arbitrary Axis
Basic Idea
y 1. Translate (x1, y1, z1) to the
origin
T
(x2,y2,z2) 2. Rotate (x’2, y’2, z’2) on to the z
R axis
3. Rotate the object around the z-
(x1,y1,z1)
axis
x 4. Rotate the axis to the original
R-1
orientation
z
5. Translate the rotation axis to
T-1
the original position

R ( ) = T −1R −x 1 ( )R −y1 ( )R z ( )R y ( )R x ( )T
Case 2….
 Step 1. Translation
y

(x2,y2,z2) 1 0 0 − x1 
0 1 0 − y1 
T=
(x1,y1,z1) 0 0 1 − z1 
 
x
0 0 0 1 

z
Case 2….
 Step 2. Establish [ TR ]x x axis
y b b
sin  = =
b2 + c2 d
(0,b,c) c c
(a,b,c) cos  = =
b2 + c2 d
Projected
Point   1 0 0 0 1 0 0 0
0 cos  − sin  0 0 c / d −b/d 0
x R x ( ) =  =
0 sin  cos  0  0 b / d c/d 0
z    
0 0 0 1  0 0 0 1
Rotated
Point
Case 2….
 Step 3. Rotate about y axis by β
y a d
sin  = , cos  =
l l
l 2 = a2 + b2 + c2 = a2 + d 2
(a,b,c)
d = b2 + c2
Projected l
Point cos  0 − sin  0  d / l 0 − a / l 0
d  0 1 0 0  0 1 0 0
 x R y ( ) =  =
 sin  0 cos  0  a / l 0 d / l 0
(a,0,d)    
 0 0 0 1  0 0 0 1
Rotated
z Point
Case 2….
 Step4. Rotate about z axis by the
desired angle 
y

cos  − sin  0 0
 sin  cos  0 0
R z ( ) = 
 0 0 1 0
l
x  
  0 0 0 1

z
Case 2….
 Step 5. Apply the reverse transformation
to place the axis back in its initial position
y
1 0 0 − x1  1 0 0 0
0 1 0 − y1  0 cos sin  0
T R x ( )R y ( ) = 
−1 −1 −1

l 0 0 1 − z1  0 − sin  cos 0
  
0 0 0 1  0 0 0 1
 cos  0 sin  0
l  0
x  1 0 0
− sin  0 cos  0
 
 0 0 0 1
z

R ( ) = T −1R −x 1 ( )R −y1 ( )R z ( )R y ( )R x ( )T
Scaling about Arbitrary Point
(w.r.to. Fixed Point)
3.5 Types of Projections
 Transforming 3D points into 2D is called
Projection
 Map viewing coordinates to 2D screen coordinates
 Mapping of any point P(x,y,z) to P
 Process of representation a 3D Object onto a
2D Screen

 Types,
◦ - Parallel
◦ - Perspective
Planar geometric projection

Parallel Perspective

Orthographic Oblique One-point Three-point

Two-point
Top
Axonometric Cabinet Other
Front
Cavalier
Side
Viewing Parameters
Viewing Parameters

 View reference point


◦ Center of our viewing coordinate system, chosen
to be close to or on the surface of some
object in a scene.
 View Plane
◦ A view plane is nothing but the film plane in a
camera which is positioned and oriented for a
particular shot of the scene.
 View distance
◦ distance from the view plane to the view
reference point
Parallel Projection
 Center of projection is at infinity
◦ Direction of projection (DOP) same for all points

DOP

View Plane
Parallel Projection
Orthographic & Oblique
 Orthographic parallel projection
◦ the projection is perpendicular to the view
plane

 Oblique parallel projection


◦ The projectors are inclined with respect to
the view plane
Orthographic Projections
 DOP perpendicular to view plane

Front

Top Side
Oblique Projections
 DOP not perpendicular to view plane

Cavalier Cabinet
(DOP at 45) (DOP at 63.4)
Perspective Projections

foreshortening - an object is from


the camera , the smaller it
appears in the final image
Perspective Projection
 Map points onto “view plane” along
“projectors” emanating from “center of
projection”(cop)

Center of
View Plane
Projection
Vanishing Points
 Parallel lines (not parallel to the projection plan) on the
object converge at a single point in the projection (the
vanishing point)
 Drawing simple perspectives by hand uses these vanishing
point(s)

vanishing point

Angel: Interactive Computer Graphics 3E ©


Addison-Wesley 2002 34
Perspective Projection
 How many vanishing point?
Perspective Projection
 How many vanishing point?

Three-point
perspective
Perspective Projection
 How many vanishing point?

Three-point Two-point
perspective perspective
Perspective Projection
 How many vanishing point?

Three-point Two-point One-point


perspective perspective perspective
Perspective Projection
 How many vanishing point?

Three-point
perspective
Perspective Projection
 How many vanishing point?

Three-point Two-point
perspective perspective
Perspective Projection
 How many vanishing point?

Three-point Two-point One-point


perspective perspective perspective
Thank you....

You might also like