Sei sulla pagina 1di 3

Homework-3

CAP405: COMPUTER GRAPHICS

DOA: DOS:

Part A:

1) Derive a matrix for Window to viewport transformation and also discuss the
importance of window to viewport transformation

2) Write all the steps to Implement the cohen- sutherland line clipping algorithm.

Ans: The Cohen-Sutherland Line-Clipping Algorithm

The more efficient Cohen-Sutherland Algorithm performs initial tests on a line to


determine whether intersection calculations can be avoided.

Steps for Cohen-Sutherland algorithm

1) End-points pairs are check for trivial acceptance or trivial rejected using the
outcode.

2) If not trivial-accepance or trivial-rejected, divided into two segments at a clip


edge.

3) Iteratively clipped by testing trivial-acceptance or trivial-rejected, and divided


into two segments until completely inside or trivial-rejected.

Trivial acceptance/reject test

To perform trivial accept and reject tests, we extend the edges of the clip
rectangle to divide the plane of the clip rectangle into nine regions. Each
region is assigned a 4-bit code deteermined by where the region lies with
respect to the outside halfplanes of the clip-rectangle edges. Each bit in the
outcode is set to either 1 (true) or 0 (false); the 4 bits in the code correspond
to the following conditions:

* Bit 1 : outside halfplane of top edge, above top edge

Y > Ymax

* Bit 2 : outside halfplane of bottom edge, below bottom edge

Y < Ymin
* Bit 3 : outside halfplane of right edge, to the right of right edge

X > Xmax

* Bit 4 : outside halfplane of left edge, to the left of left edge

X < Xmin

3) Can we say that like images, texts can also be clipped? If yes, justify your
answer by taking an example text and perform clipping.

Ans: Yes we say that images, texts also be clipped. A clip path is a drawing outline
that can be combined with another image such as a bitmap, or vector clip art. The
image inside or outside of the outline can be masked or deleted. Any closed outline
can be used as a clip path. Existing shapes or text can be used or clip paths can be
drawn around objects to pick them out of the background.

Examples of Clipping:

Graphic images can be built up by placing one clipped image over another, and then
vector artwork or text can be added. Clip paths can also be created from text
allowing you to create some interesting fills.

Import the photograph into 2D Design V2

Draw a clip path around the mini and mask the outside
Import the second photo and put the clipped photo and some text on top

Part B:

4) Elaborate how Sutherland hodgeman is better then weiler Atherton polygon


clipping algorithm.

5) Elaborate the various text clipping techniques used to clip a text by taking
suitable example.

6) Differentiate between Interior clipping and Exterior clipping. In what form exterior
clipping can be useful? Illustrate using some examples? Draw diagrams to define
pictorially?

Potrebbero piacerti anche