Final
Final
Transformation
Transformation means to change. There are 4 main types of transformations that one can
perform in 2 dimensions.
1. Translations
2. Rotation
3. Scaling
4. Shearing
5. Reflection
Translation : Translation moves the object form one position to another position
in a straight line
Roation
x=rcos..... (1)
y=rsin...... (2)
Substituting equation (1) & (2) in (3) & (4) respectively, we will get
x=xcosysin
y=xsin+ycos
P = P . R
X-Shear
The X-Shear preserves the Y coordinate and changes are made to X coordinates
X' = X + Shx. Y
Y = Y
Y-Shear
Y = Y + Shy . X
X = X
Reflection
Note that there are two angles between the lines, an acute one and an obtuse one. To find
acute angle b/w lines
Sometimes the complete picture of object in the world coordinate system is too large and
complicate to clearly show on the screen, and we need to show only some part of the object.
When a window is "placed" on the world, only certain objects and parts of objects can be
seen. Points and lines which are outside the window are "cut off" from view. This process of
"cutting off" parts of the image of the world is called Clipping.
Q. Let the co-ordinates of point in real world are (6,8 ) .What are its coordinates
in viewport .The widow size is given in diagram for both Real World and
Viewport
10,10
4,4
Real World
20,20
15,15
15,15 ViewPort
Clipping
Point Clipping :-
Lecture -4
4 bit code
If both the endpoints have code 0000 : Draw complete line
If Code of one end point And Operation Code of other end point = Non Zero,
it means line is completely outside the window . Clip it completely
If Code of one end point And Operation Code of other end point = Zero, it
means line is completely outside the window or line is partially inside partially
outside the window .
Lecture -5,6
Like Cohen Sutherland Algo line is tested for visibility. If the line is completely
visible it is drawn and if it is completely invisible it is rejected.
The difference between these two algorithms is that in Cohen Sutherland Algo
we have to calculate the intersection of line with the window edge . These
calculations can be avoided by repetitively subdividing the line at its midpoint
.The visibility test are then applied to each half. This subdivision process is
repeated until we get completely visible or completely invisible line segment
If any p value is zero then line is parallel to the window (may be inside, may be outside,
may be on boundary) .Check the corresponding q
For all pk< 0 (The point is called potentially entering point ) find t1
t1=Max( 0 , qk / pk )
For all pk> 0 (The point is called potentially leaving point ) find t2
Once you get t1 and t2 check If t1 > t2 then line is completely outside therefore
reject
Otherwise find the intersection points as
Lecture -7
Lecture -8
Starting vertex of edge is never saved, we will be saving only intersection point (always )
and last vertex (if it lies inside clipping window)
1) Translations
2) Rotation
3) Scaling
4) Shearing
5) Reflection
Translation
Rotation ( About any axis )
About Plane
3D Homogeneous Coordinate