0% found this document useful (0 votes)
34 views49 pages

Computer Graphics: Unit-3 2D, 3D Transformation and Projections

Uploaded by

sidghogare51
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)
34 views49 pages

Computer Graphics: Unit-3 2D, 3D Transformation and Projections

Uploaded by

sidghogare51
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/ 49

Computer Graphics

Unit-3 2D,3D Transformation


and Projections

By Chetana Shravage
2D Transformation-
● Manipulation done on object.
● Translation - changing the position
tx- translation parameter with respect to x-axis
ty- translation parameter with respect to y-axis
● Scaling - Resizing the object
Sx - Scaling parameter with respect to x-axis
Sy - Scaling parameter with respect to y-axis
● Rotation - Rotate object
Rotate clockwise & anticlockwise
1) Translation- changing the position
P(x,y)-point before translation

P’(x’,y’)-point after translation

tx- translation parameter with respect to x-axis

ty- translation parameter with respect to y-axis

x’= x + tx

y’= y + ty

P’= P + T

Matrix Form- [x’ y’]=[x y]+[tx ty]


Exa. Consider square (0,0),(2,0), (0,2), (2,2) with tx=2, ty=3
(0,0)
x’=0 + 2 =2
y’=0 + 3=3
(0,0) →(2,3)

(2,0)
x’=2 + 2 =4
y’=0 + 3=3
(2,0) →(4,3)

(0,2)
x’=0 + 2 =2
y’=2 + 3=5
(0,2) →(2,5)

(2,2)
x’=2 + 2 =4
y’=2 + 3=5
(2,2) →(4,5)
2) Scaling-Resize the object

● Sx - Scaling parameter with respect to x-axis


● Sy - Scaling parameter with respect to y-axis
● Both if Sx & Sy in between 0 & 1
○ Point is closer to origin
○ Size decreases
● if Sx & Sy are greater than 1
○ Point is away from origin
○ Size increases
● If Sx & Sy are equal
Scaling will be done uniformly
x’=x.Sx
y’=y.Sy
Matrix form-
Exa 1). Consider square (0,0),(2,0), (0,2), (2,2) with Sx=2, Sy=3
(0,0)
x’=0 * 2 =0
y’=0 * 3=0
(0,0) →(0,0)

(2,0)
x’=2 * 2 =4
y’=0 * 3=0
(2,0) →(4,0)

(0,2)
x’=0 * 2 =0
y’=2 * 3=6
(0,2) →(0,6)

(2,2)
x’=2 * 2 =4
y’=2 * 3=6
(2,2) →(4,6)
Exa 2). Consider square (0,0),(2,0), (0,2), (2,2) with Sx=0.5, Sy=0.5
(0,0)
x’=0 * 0.5 =0
y’=0 * 0.5=0
(0,0) →(0,0)

(2,0)
x’=2 * 0.5 =1
y’=0 * 0.5=0
(2,0) →(1,0)

(0,2)
x’=0 * 0.5 =0
y’=2 * 0.5=1
(0,2) →(0,1)

(2,2)
x’=2 * 0.5 =1
y’=2 * 0.5=1
(2,2) →(1,1)
3) Rotation-
Example 1) Note-If not mention direction in exa. Consider Anticlockwise.
Example 2)
4) Shearing-
x-shear - y same only x distorted

y’=y

x’=x +Shx.y x shearing parameter

y-shear - x same only y distorted

x’=x

y’=y +Shy.x y shearing parameter


Exa 1). Consider square (0,0),(2,0), (0,2), (2,2) with Shx=2 units

(0,0) (0,2)
x’=0 + 2.0 =0 x’=0+2.2=4
y’=0 y’= 2
(0,0) →(0,0) (0,2) →(4,2)

(2,0) (2,2)
x’=2 + 2.0 =2 x’=2 +2.2=2+4 =6
y’=0 y’=2
(2,0) →(2,0) (2,2) →(6,2)
Exa 2). Consider square (0,0),(2,0), (0,2), (2,2) with Shy=2 units

(0,0) (0,2)
x’= 0 x’=0
y’=0 + 2.0=0 y’= 2 + 2.0=2
(0,0) →(0,0) (0,2) →(0,2)

(2,0) (2,2)
x’=2 x’=2
y’=0 + 2.2=4 y’=2+2.2=2+4=6
(2,0) →(2,4) (2,2) →(2,6)
Homogeneous Coordinates Representation-
● Homogeneous coordinates means 2D matrix converted into 3D matrix for
simplification. (x,y) → (xh,yh,h) where h- any non-zero for simplification,
consider h=1
1) Translation- Homogeneous matrix 2) Scaling-Homogeneous matrix
representation of Translation representation of Scaling
Homogeneous Coordinates…
3) Rotation- Homogeneous matrix 2) Shearing-Homogeneous matrix
representation of Rotation representation of Shearing
(anticlockwise)
Rotation about an arbitrary point-
● We have derived rotation matrices
with respect to origin but suppose
reference point of rotation is other
than origin we must follow 3 steps-

Step 1- Arbitrary point translate to


origin (0,0) tx=-xp, ty=-yp
Rotation about an arbitrary point…
Step 2- Rotate at 𝝷 angle

Step 3- Translate back at same


Arbitrary position tx=xp, ty=yp
Rotation about an arbitrary point…
Now let us form a combined matrix

This is transformation matrix is overall transformation matrix for rotation about arbitrary
point (xp,yp) by an angle 𝝷 in anticlockwise direction.
3D Transformation-
● Translation - changing the position/moving the object tx,ty,tz
● Scaling - Resizing the object/changing the size Sx,Sy,Sz
● Rotation - Rotate object with 𝝷
Rotate clockwise & anticlockwise
● Shearing - Tilting the object
x-shear, y-shear, z-shear
1) 3D Translation-
tx- translation parameter with respect to x-axis x’= x + tx
ty- translation parameter with respect to y-axis y’= y + ty
tz- translation parameter with respect to z-axis z’= z + tz
2) 3D Scaling-
Sx- Scaling parameter with respect to x-axis x’= x . Sx
Sy- Scaling parameter with respect to y-axis y’= y . Sy
Sz- Scaling parameter with respect to z-axis z’= z . Sz
3) 3D Rotation-
A. X-axis rotation
B. Y-axis rotation
C. Z-axis rotation
A. X-axis rotation
B. Y-axis rotation
C. Z-axis rotation
4) 3D Shearing-
A. Shearing in X-axis
B. Shearing in Y-axis
C. Shearing in Z-axis
A. Shearing in X-axis
B. Shearing in Y-axis
C. Shearing in Z-axis
3D Homogeneous Coordinates Representation-
1) Translation- 2) Scaling-

3) Rotation-anticlockwise 4) Shearing-
3D Rotation about an arbitrary point-
● If we want to rotate a point (x,y,z) by an angle 𝝷 which is in space and lying on
an arbitrary axis then we have to follow 7 steps as follows:
Step 1- Translate(T) the arbitrary axis so that it will pass through the origin.
3D Rotation about an arbitrary point..
Step 2-Perform rotation about x-axis(Rx)
until arbitrary axis completely lies in xz plane

Step 3-Perform rotation about y-axis(Ry) until


arbitrary axis coincides with z-axis
3D Rotation about an arbitrary point..
Step 4- perform the desired rotation by theta about
the z axis (Rz)

Step 5-Perform reverse rotation about y-axis(Ry-1)


3D Rotation about an arbitrary point..
Step 6-Perform reverse rotation about x-axis(Rx-1)

Step 7- Perform Inverse translation (T-1)to original


Position
So, final transformation matrix for rotation about
arbitrary axis is
RA=T . Rx . Ry . Rz . Ry-1 . Rx-1 . T-1
Projections-
● Representing n-dimensional object into n-1 dimension is known as projection.
i.e It is the process of converting a 3D object into a 2D object.
● It is also defined as mapping or transformation of the object projection plane
or view plane.
● Projection are of 2 types
1) Parallel Projection
2) Perspective Projection
Projection Types-
1) Parallel Projection-
● Projection lines are parallel to each other and extended from the object and
intersect to the view plane.
● Projection is said to be parallel because parallel lines meet at infinity i.e.
center of projection (COP) is at infinite distance from the projected plane.
2) Perspective Projection-
● In perspective projection line of projection are not parallel, all projection lines are
ending at a single point called COP.
● COP is at finite distance from projected plane.
● Difficult to determine
exact size and shape of object.
● Object appear smaller as
distance from COP increases..
Application : The perspective
projection technique is used by
artists in preparing drawings of three-dimensional
objects and scenes
Types of Parallel Projection-
i) Orthographic
ii) Oblique
Let us see first type-

i) Orthographic- In orthographic projection the


direction of projection is normal to the projection
of the plane.

➢ Front view,Top view, Side view


➢ In orthographic lines are parallel
to each other making an angle 90°
with view plane
Types of Orthographic-

a) Isometric projection- If we consider cube, by using isometric orthographic


projection we can see 3 plane having equal angle & equal sides.

b) Dimetric projection-In dimetric, the direction of projection in such way 2 angles are
equal, 2 sides are equal.

c) Trimetric projection-No any angles also no any sides are equal.


Types of Parallel Projection..
ii) Oblique-In oblique projection the direction of projection is not normal to the
projection of the plane.
➢ We can view object better than orthographic projection.
Types of oblique are:
a) Cavalier- If the projected line making an angle 45° with projected plane.
In this projection, the length of
the reading axis is larger than
the cabinet projection.
Types of Oblique Projection..

b) Cabinet Projection-In Cabinet the length of reading axes just half than the
cavalier projection.
The incident angle at
the projecting plane
is 63.4′ rather 45′.
Types of Perspective Projection-
1) One Point perspective-
● One point perspective projection occurs when any of principal axes intersects
with projection plane or we can say when projection plane is perpendicular to
principal axis.
● In the above figure, z axis intersects projection plane whereas x and y axis
remain parallel to projection plane.
Types of Perspective Projection..
2) Two Point perspective-

● Two point perspective projection occurs when projection plane intersects two of
principal axis.
● In the above figure, projection plane intersects x and y axis whereas z axis remains
parallel to projection plane.
Types of Perspective Projection..
3) Three Point perspective-
● Three point perspective projection occurs when all three axis intersects
with projection plane.

● There is no any principal axis


which is parallel to projection plane.

You might also like