0% found this document useful (0 votes)
127 views9 pages

Homework-3 Cap405: Computer Graphics

This document is a homework submission for a computer graphics course. It contains questions and answers related to window to viewport transformation, clipping methods, and the Cohen-Sutherland line clipping algorithm. The student declares that the assignment represents their own work.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views9 pages

Homework-3 Cap405: Computer Graphics

This document is a homework submission for a computer graphics course. It contains questions and answers related to window to viewport transformation, clipping methods, and the Cohen-Sutherland line clipping algorithm. The student declares that the assignment represents their own work.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Homework-3

CAP405: COMPUTER GRAPHICS

Submitted to – Submitted by-


Lect. Sandeep Sharma Surendra
MCA 4th SEM
D3804A15
10806601

DECLARATION

It is declared by me that this assignment is purely my effort and I had done


my assignment of my own. I accept that I had taken the help of internet and
books of modern programming tools and technique but I had used my own
language while answering the questions of homework 1. I had tried my best
to make my assignment unique from other student.

DECLARED BY

Surendra
Part A

1) Illustrate the concept of Window to view-port transformation by


taking a real world example.

Answer:
“The process that converts objects coordinates in WCS to
normalized device coordinates is called Window to view-port
transformation ”.

Window to view-port transformation having three steps transformation


composition as suggested by the following sequence of pictures:

 As the world window increases in size the image in viewport


decreases in size and vice-versa.

Used in two applications:

 Panning - Moving the window around the world

 Zooming- Reducing/increasing the window size

2) Differentiate following terms by taking suitable example:


a) Window

b) View port

c) Clipping

ANSWER:

 A world-coordinate area selected for display is called a window.


 An area on a display device to which a window is mapped is called a
viewport. The window defines what is to be viewed; the viewport
defines where it is to be displayed.
 Generally, any procedure that identifies those portions of a picture that
are either inside or outside of a specified region of space is referred to
as a clipping algorithm, or simply clipping.

yw max

yv max
yw min
yv min

xw min xw max xv min xv max


Example of window and viewport:

yw

xw
3) Give the different scenarios under which various clipping methods
will be applicable and useful.

ANSWER:

P4
y y
P3 P2
ywmax ywmax
P1 P1
P6 P6
P7 P5 P5

P7

P8
P10 P8 P10 ′
P9
ywmin ywmin
P9

xwmin xwmax x xwmin xwmax x

xmin ≤ x ≤ xmax
ymin ≤ y ≤ ymax

wind
Part B

4) Develop a procedure to implement Cohen Sutherland line clipping


Algorithm.

ANSWER: all or none


segment) or whether both are left of
text clipping
First we test whether both endpoints are inside (and hence draw the line
, right of ,
below , or above (then we ignore line segment). Otherwise
we split the line segment into two pieces at a clipping edge (and thus reject one
part). Now we proceed iteratively.

A rather simple accept-reject test is the following:

Divide the plane into 9 regions and assign a 4 bit code to each:
1000
...above top edge
0100
...below bottom edge
0010
...right of right edge
0001
...left of left edge
Maths calculates the corresponding bit-codes for both endpoints.

Figure: Codes for the 9 regions associated to clipping rectangle

If both codes are zero then the line segment is completely inside the rectangle.
If the bitwise-and of these codes is not zero then the line does not hit since both
endpoints lie on the wrong side of at least one boundary line (corresponding to a
bit equal to 1). Otherwise take a line which is met by the segment (for this find
one non-zero bit), divide the given line at the intersection point in two parts and
reject the one lying in the outside halfplane.

Figure: Example of Cohen-Sutherland line-clipping algorithm


5) Take an example and perform interior and exterior clippings on
the Text.

ANSWER: A typical example of the application of exterior clipping is in


multiple window systems.3rd is exterior clipping and

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

ANSWER:

We can say that like images, texts can also be clipped.

Three strategies can be followed:

• all-or-none string clipping


– use a bounding rectangle for the string
• all-or-none character clipping
– use a bounding rectangle for the character
• individual character clipping
– like line/curve clipping (outlined char’s)
- compare individual pixels (bit-mapped

You might also like