Homework-3 Cap405: Computer Graphics
Homework-3 Cap405: Computer Graphics
DECLARATION
DECLARED BY
Surendra
Part A
Answer:
“The process that converts objects coordinates in WCS to
normalized device coordinates is called Window to view-port
transformation ”.
b) View port
c) Clipping
ANSWER:
yw max
yv max
yw min
yv min
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
xmin ≤ x ≤ xmax
ymin ≤ y ≤ ymax
wind
Part B
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.
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.
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: