You are on page 1of 3

Computer Graphics and Multimedia

Q1. Explain Sutherland-Hodgman polygon clipping algorithm with an example.


Sutherland-Hodgeman Polygon Clipping Algorithm :
 Read coordinates of all vertices of the polygon.
 Read coordinates of the clipping window
 Consider the left edge of the window
 Compare the vertices of each edge of the polygon, individually with the clipping plane
 Save the resulting intersections and vertices in the new list of vertices according to
four possible relationships between the edge and the clipping boundary discussed
earlier.
 Repeat the steps 4 and 5 for remaining edges of the clipping window. Each time the
resultant list of vertices is successively passed to process the next edge of the
clipping window.
 Stop.
 Example 1 Input : Polygon : (100,150), (200,250), (300,200)
 Clipping Area : (150,150), (150,200), (200,200),
 (200,150) i.e. a Square
 Output : (150, 162) (150, 200) (200, 200) (200, 174)


 Example 2
 Input : Polygon : (100,150), (200,250), (300,200)
 Clipping Area : (100,300), (300,300), (200,100)
 Output : (242, 185) (166, 166) (150, 200) (200, 250) (260, 220)

Q2. Which type of clipping windows cannot be handled by Cyrus Beck line clipping algorithm ? How can such cases
be handled?
Cyrus Beck is a line clipping algorithm that is made for convex polygons. It allows line
clipping for non-rectangular windows, unlike Cohen Sutherland or Nicholl Le Nicholl. It
also removes the repeated clipping needed in Cohen Sutherland.
Input:
1. Convex area of interest
which is defined by a set of coordinates
given in a clockwise fashion.
2. vertices which are an array of coordinates:
consisting of pairs (x, y)
3. n which is the number of vertices
4. A line to be clipped
given by a set of coordinates.
5. line which is an array of coordinates:
consisting of two pairs, (x0, y0) and (x1, y1)
Output:
1. Coordinates of line clipping which is the Accepted clipping
2. Coordinates (-1, -1) which is the Rejected clipping

Algorithm:
 Normals of every edge is calculated.
 Vector for the clipping line is calculated.
 Dot product between the difference of one vertex per edge and one selected end point
of the clipping line and the normal of the edge is calculated (for all edges).
 Dot product between the vector of the clipping line and the normal of edge (for all
edges) is calculated.
 The former dot product is divided by the latter dot product and multiplied by -1. This is
‘t’.
 The values of ‘t’ are classified as entering or exiting (from all edges) by observing their
denominators (latter dot product).
 One value of ‘t’ is chosen from each group, and put into the parametric form of a line
to calculate the coordinates.
 If the entering ‘t’ value is greater than the exiting ‘t’ value, then the clipping line is
rejected.

Q3. Find the final coordinates of a triangle ABC with coordinates A(0, 0), B(1, 1) and C(5, 2), subjected to
anticlockwise rotation of 45 about the origin

Q4. What is the problem of Aliasing ? How does the technique of anti-aliasing work to get rid of the
problem of aliasing ?

You might also like