Ch4 - studing

advertisement
Ch4.
Q1. What is window ?
Q2. What is view port ?
Q3. Compare window & view port ?
Q4. What is windowing ?
Q5. What is viewing transformation state its types ?
Q6. Describe normalization transformation ?
Q7. Explain workstation transformation ?
Q8. Explain normalization co-ordinate matrix ?
Q9. Define clipping state its primitives ?
Q10. Explain point clipping and state its applications?
Q11. Explain text clipping by example?
Q12. Describe various categories of line?
Q13. Describe 4-bit region code?
Q14. Describe cohen Sutherland line clipping concept algorithm?
Q15. Describe line clipping by midpoint concept, algorithm, demerits, merits?
Q16. Explain polygon clipping by Sutherland hogeman concept, algorithm, merits & demerits ?
Q. What is windowing?
Ans: The process of selecting and viewing the picture with different view is called as windowing.
Q. what is clipping ?
Ans: The process which divides each element of the picture in to its visible and non-visible portion allowing the invisible
portion to be discarded is called as clipping.
Q. what is window?
Ans: A rectangular area specified in world co-ordinates is called window. The window defines what is to be viewed. The
window is generally rectangle in size.
Q. what is view port?
Ans: The rectangular area on the display device to which window is mapped is called as view port. The view port defines where the
picture is to be displayed. It is also rectangular in size.
Q . compare window and view port?
Ans:
windows
1. A word co-ordinate area selected for display input is
called as window
2. The window decide what is to be viewed
3. It is process of selecting and viewing the picture
4. Rectangular in shape
5. Decide the input
6. Camera
7. Infinite co-ordinates
viewport
The rectangle are on the display device to which window is
mapped is called as viewport
View port decide where the output will be displayed
It is process of having a proper displayed object
It can be square or rectangular
Decide the output
Any display device
Limited co-ordinates
Q. what is viewing transformation? state its types?
Ans: Pictures are defined and stored into memory using a convenient Cartesian co-ordinate system called as world system
(WCS). When a picture is to be displayed on a display device (having physical device co-ordinate ) then corresponding
display device co-ordinate should be considered for mapping or to get the desired image. The physical device co-ordinate
if are different might produce undesired picture information / display the mapping of device co-ordinate and world coordinate is achieved for better result output. This co-ordinate transformation is known as viewing transformation.
The viewing transformation is performed by 2 ways:
1. Normalization transformation
2. Workstation transformation
Q. Describe normalization transformation?
Ans: As different display devices may have different screen sizes is measured in pixels. The size of screen in pixel
increases as the resolution of the screen increases. When the picture is defined in pixel values then it is the displayed large
in size on the low resolution screen while small in size on the high resolution screen.
To avoid this and to make our program to be device independent we have to define the picture in co-ordinates in some unit
other than pixels and use the interpreter to convert these co-ordinates to appropriate pixel values for particular display
device. This process of making the picture device independent is called as normalization transformation.
The normalization screen co-ordinate will be considered maximum as (1,1).
The transformation which maps the world co-ordinate to normalized device co-ordinate is called normalization
transformation. Since, it involves scaling of x & y co-ordinate. Therefore, it is also termed as scaling transformation.
Q. Describe workstation transformation?
Ans: The transformation which maps the normalized device co-ordinate to physical device co-ordinate is called
workstation transformation
As we know that the world co-ordinate system is infinite & the device display area is finite (limited)
To perform a viewing transformation we select a finite world co-ordinate area for display called as window and the area
where we want to display the o/p(view code) the windows defined with view and view code should be mapped
The window defined in world co-ordinate system is 1st transformed in to normalized device co-ordinate. This normalized
are again transformed in to view port (display device) co-ordinates. This process of window to view port co-ordinate
transformation is known as workstation transformation.
Q. Explain normalization co-ordinate matrix?
Ans: formula:
Sx=(Vxmax-Vxmin)/(Wxmax-Wxmin)
Sy=(Vymax-Vymin)/(Wymax-Wymin)
N=
Sx
0
0
-Sx Wxmin+Vxmin
Sy
-Sy Wymin+Vymin
0
0
1
Where:
X&Y are co-ordinates
W is window
V is view port
Vmin is view port minimum boundary
Vmax is view port maximum boundary
Wmin is window minimum boundary
Wmax is window maximum port
Q. what are various clipping primitives?
Ans: A procedure that identifies a portion of a picture is either inside or outside of a specified region (window) is referred
as the clipping which allows the user to discard the invisible portion & select the desired part of the picture which falls in
window various algorithms are used for clipping. The clipping is done for point clipping, line clipping, polygon clipping &
text clipping.
Q. Explain point clipping & state its application?
Ans: In point clipping, if a specified point is inside the clipping window then it is accepted and displayed on the screen.
The point which lie outside the window are rejected.
If p is a point
X min <=p<= X max
and y min<=p<=y max
then ‘p’ is selected.
by point clipping we test the co-ordinates of specified point with the window boundary is decided by Xmin , y min and x
max, y max
As seen from the above diagram if point p is to be selected if it satisfies the condition given by window boundary then the
point will be clipped and displayed on the view port if the point does not fall with in the window boundary they will be
rejected in above diagram point p1 & p3
will be dipped & displayed while point p2 & p4 are rejected points.
Application:
1. used to show explosion
2. It is used to describe the particles in an object
Q. Explain text clipping by example?
Ans: The clipping of text is generally dependent on how the text generated and will the requirement of clipping is divided
in to 3 methods:
1. No clipping:
Here, the clipping of the text is not done where the text completely falls inside window
2. No character clipping:
In this method, the half of it character string falls inside complete visible window and half falls outside the
window. Therefore, the clipping does not take place.
3. Character clipping:
In this method, one of character from the string might intercet the window boundary . Therefore, character part
which falls inside window will be selected and the character part which falls outside window boundary will be deleted.
Q. Describe various categories of line?
Ans: The various categories of line are:
1. visible:
Here both the end points of the line fall in the window boundary. In above diagram line segment AB & GH fall
inside the window boundary so they are completely visible.
2. Invisible(not visible):
In this both ends of a line segment fall outside the window boundary in the above diagram line EF & IJ will
not be visible
3. clip lines:
In this category the end points of the line may or may not lie inside the window but even part of line falls
inside the window then such lines are clipped such that the art of the line which falls inside and the part which falls
outside the window will be discarded or rejected in the above diagram line CD will be clipped & part of it will be
Q. Describe 4-bit region code?
Ans: The line clipping is done by various approach and methods one of the line clipping method developed by cohen
Sutherland technique is clip the line by using 4-digit binary code this 4-digit binary code is also called as region code in
which it specifies the co-ordinates of various region windows as left, right, bottom and top.
If
bit 1=1----------------left
bit 2=1----------------right
bit 3=1----------------bottom
bit 4=1----------------top
Q. Describe cohen Sutherland line clipping concept, algorithm, demerits & merits?
Ans: The cohen’s Sutherland has designed a 9-bit cell having the values as displayed above. The window is designed by xmin,
y-min to x-max, y-max. This 9-bit code is also called as region code. if point 1 is set to 1 then the point co-ordinate are on
left side of the window
If the bit 2 nd is set as 1 then the point is on right side of the window
If the 3 rd bit is set as 1 then the point falls below the window
If the 4th bit is set as 1 then the point is above the window
The cohen Sutherland method finds out end point co-ordinate and performs the logical anding operation on the end points
of the co-ordinates.
Line
p1-p2
p3-p4
p5-p6
p7-p8
p9-p10
Right
0001-1000
0100-0110
0000-0000
0010-1010
0000-0000
Anding
0000
0100
0000
0010
0000
Result
partially visible
not visible
visible
not visible
visible
From the above table, if the logical anding operation produces the result as 0000 then the line is either complete visible or
partially visible depending on its end points co-ordinates.
If the anding result of both the end points of line is not 0000 then it means the line does not interest the window so such
lines are to be discarded
Algorithm:
step1: Read end points of line as p1(x1,y1) & p2(x2,y2)
step2: Accept the lower left and upper right co-ordinates of the clipping window i.e Xmin, Ymin & Xmax,Ymax
step3: Assign 4-bit region code to p1 & p2
step4: Check the category of line for its visibility (logical Anding i.e checking end points by )
step5: If line is inside window accept it and display it. If the line is partially visible then clip the line according to
boundary
step6: Find out the point of intersection of line with window boundary
step7: Replace the end points with intersection points and form a new line and discard the remaining part of line
Merits:
Q. Describe line clipping by midpoint concept, algorithm, merits, demerits?
Ans: The midpoint subdivision line clipping algorithm divides the line by finding the midpoint of the line
The cohen Sutherland algorithm requires the calculation of intersection of line with the window edge. These calculation
take a longer time and therefore method of line clipping is slow in this the line is first tested or checked for its visibility. If
it is partially visible then only the dipping will take place.
In mid point subdivision line elipping method we first find out the visibility of line as similar to that of cs algorithm. Then
for partially visible lines we find out the midpoint of line segment and subdivided it in to equal parts . The line division by
midpoint is carried out till the line is broken in to visible and not visible lines.The midpoint of the line is found out by
(X2+X1)/2 or (Y2+Y1)/2
We have a line segment p1-p2 1st it is checked for the region code. The region code for p1 is 0101 while p2= 1010. While
forming the logical anding operation the result is 0000. It means the line is partially visible so the line is to be clipped. By
midpoint subdivision method line segment p1,p2 is divided 1st at p3 then the line segment p1-p3 & p2-p3
Are checked for region code. Again they fall in partially visible category. Now again both the lines are divided till we get a
completely visible and invisible line. Such invisible line portion will be rejected while the visible portion will be selected
or displayed.
Merits:
Q. Explain polygon clipping by Sutherland hodgeman concept, algorithm, merits & demerits?
Ans: step1: Read co-ordinates of all vertices of the polygon
Step2: Read co-ordinates of the clipping window
Step3: consider the left edge of the window
step4: compare the vertices of each edge of the polygon individually with the clipping plane
step5: save the resulting intersections and vertices in the new list of vertices according to four possible relationships
between the edge and the clipping boundary as
i.
ii.
If the first vertex of the edge is outside the window boundary and the second vertex of the edge is inside then
the intersection point of the polygon edge with the window boundary and the second vertex are added to the
vertex list
If both vertices of the edge are inside the window boundary, only the second vertex of the edge is outside,
Only the second vertex is added to the output vertex list
iii.
iv.
If the first vertex of the edge is inside the window boundary and the second vertex of the edge is outside only
edge intersection with the window boundary is added to the output vertex list
If both vertices of the edge are outside the window boundary, nothing is added to the output list
Step6: Repeat the steps 4 & 5 for remaining edges of the clipping window. Each time the resultant list of vertices is
successively passed to the process the next edge of the clipping window
Step7: stop
Download