CG Exp 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Name : Vaibjab Arun Kokate

Roll No : C23350
Div : 3(C)
Batch : S11

Subject : CGL
Experiment No. 2
Questions:

1. What Is Cohen Sutherland clipping?


Ans: Line clipping is a clipping concept in which lines that lies outside the clipping window is
removed from the clip region. As a result, only lines which is inside the view plane are visible.
Cohen Sutherland Algorithm is one of the popular line clipping algorithm used for the purpose.

2. Name the different algorithms of polygon clipping?


Ans: 1) Sutherland - Hodgeman Polygon Clipping Algorithm
2) Weiler-Atherton Algorithm
3) Liang-Barsky Polygon Clipping

3. What is mean of region code?


Ans: Cohen Sutherland algorithm uses a four digit (bit) code to indicate which of nine regions
contain the end point of line.
The four bit codes are called region codes or outcodes. These codes identify the location of the
point relative to the boundaries of the clipping rectangle. Each bit position in the region code is
used to indicate one of the four relative co-ordinate positions of the point with respect to the
clipping window : to the left, right, top or bottom.

4. Explain even odd and winding number method for visibility of line?
Ans: 1) Even- Odd Method: This method determine whether the point is inside the polygon or
not. One simple method of doing this is to construct a line segment between the point in
question and a point known to be outside the polygon. Now count how many intersections of
the line segment with the polygon boundary occur. If there are an odd number of intersections,
then the point in question is inside; otherwise it is outside. This
method is called the even-odd method of determining polygon inside points.
2) Winding Number Method: Another approach to do the inside test is the winding-number
method. Let us consider a point in question and a point on the polygon boundary. Conceptually,
we can stretch a piece of elastic between these points and slide the end point on the polygon
boundary for one complete rotation. We can then examine the point in question to see how
many times the elastic has wound around it. If it is wound at least once, then the point is inside.
If there is no net winding, then the point is outside.
5. Explain Sutherland Hodgeman Clipping?
Ans: A polygon can be clipped by processing its boundary as a whole against each window
edge. This is achieved by processing all polygon vertices against each clip rectangle boundary in
turn. Beginning with the original set of polygon vertices, we could first clip the polygon against
the left rectangle boundary to produce a new sequence of vertices.
The new set of vertices could then be successively passed to a right boundary clipper, a top
boundary clipper and a bottom boundary clipper. At each step a new set of polygon vertices is
generated and passed to the next window boundary clipper. This is the fundamental idea used
in the Sutherland - Hodgeman algorithm.

You might also like