Computer Graphics and Multimedia
Computer Graphics and Multimedia
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 ?