3d Rotation
It is moving of an object about an angle and the movement can be
anticlockwise or clockwise.
𝐶𝑜𝑠𝜃 −𝑆𝑖𝑛𝜃 0 0
𝑅𝑧 𝑋 𝑌 𝑍 = 𝑆𝑖𝑛𝜃0 0
𝐶𝑜𝑠𝜃 0
1
0
0
0 0 0 1
𝐶𝑜𝑠𝜃 0 𝑆𝑖𝑛𝜃 0
𝑅𝑦 𝑋 𝑌 𝑍 = 0 1 0 0
−𝑆𝑖𝑛𝜃 0 𝐶𝑜𝑠𝜃 0
0 0 0 1
1 0 0 0
𝑅𝑧 𝑋 0 𝐶𝑜𝑠𝜃 −𝑆𝑖𝑛𝜃 0
𝑌 𝑍 = 0 𝑆𝑖𝑛𝜃 𝐶𝑜𝑠𝜃 0
0 0 0 1
3d Shearing
Shearing is the process of distortion of an object in 3D space either in x, y, or
in the z-direction.
𝑆ℎ𝑥 𝑋 𝑌 𝑍 =
𝑆ℎ𝑦 𝑋 𝑌 𝑍 =
𝑆ℎ𝑧 𝑋 𝑌 𝑍 =
Consider a square O(0, 0), B(4, 0), C(4, 4), D(0, 4) on which we first apply
T1(scaling transformation) given scaling factor is Sx=Sy=0.5 and then we
apply T2(rotation transformation in clockwise direction) it by 90*(angle), in
last we perform T3(reflection transformation about origin).
A rectangle ABCD has coordinates A (2, 3), B (6, 3), C (6, 6) and D(2, 6).
Calculate the combined transformation matrix (concatenation) for the
following operations. Also find the resultant coordinates. i) Translation by 2
units in x - direction and 3 units in y - direction. ii) Scaling by 4 - units in x -
direction and 2 - units in y - direction. iii) Rotation by 30° in
counterclockwise direction about z - axis, passing through a point (3, 3).
Clipping
Clipping is the process of discarding the part of the geometry outside
the viewing window.
Point Clipping
Line Clipping (straight-line segments)
Area Clipping (polygons)
Curve Clipping
Text Clipping
Need of Clipping
The transformations that are to be carried out for zooming and panning of the
image on the screen are applied only on the necessary geometry.
This improves the response of the system.
Point Clipping
The clip window is a rectangle in standard position, we save a point P =
(x, y) for display if the following inequalities are satisfied.
If any one of these four inequalities is not satisfied, the point is clipped
Line Clipping
4 4
3 3
1 1
Before Clipping 2 After Clipping 2
Line Clipping procedure
Test a given line segment to
1. determine whether it lies completely inside the clipping window
2. determine whether it lies completely outside the clipping window
3. if a line cannot be determined as completely inside or completely outside,
perform intersection calculations with one or more clipping boundaries.
Process lines through the "inside-outside'' tests by checking the line
endpoints.
To minimize calculations the clipping algorithms must efficiently identify
lines outside the window to reduce intersection calculations.
Need
4
To trim the extra line the algorithmic
3 must be
1) effective manner
2) Fast
Few algorithms are designed explicitly
for two-dimensional pictures, and
some are adapted to three
1 dimensional applications.
2
Need
To trim the extra line the
4 algorithmic must be
1) effective manner
3 2) Fast
For different cases different conditions must be followed.
If line is above Y max
Ya > Ymax & Yb > Ymax
If line is right of X max
Xa > Xmax & Xb > Xmax
If line is Below Y min
Ya < Ymin & Yb > Ymin
1 If line is left of X min
Xa < Xmin & Xb > Xmin
2 To trim the extra point the intersections must be found
Four pt Code
4 Reference bit 1
Xmin 1 L
Ymax 3 Xmax 2 R
Ymin 3 B
Ymax 4 A
Ymax Ymin Xmax Xmin
1 Ymin Xmin Xmax 1001 1000 1010
0001 0000 0010
2 0101 0100 0110
Four pt Code
Condition1
CODE (P1) ∩ CODE (P2) =1 (Line segment is outside the window)
Condition2
CODE (P1) CODE (P2) =0 (Line segment is inside the window)
Ymax
Ymin
Xmin Xmax