0% found this document useful (0 votes)
154 views

University of Petroleum and Energy Studies: School of Computer Science

This document contains solutions to questions from a mid-semester examination in Computer Graphics. 1) A monochrome display with a resolution of 1280x1024 pixels would require 160 KB of memory. 2) A frame buffer is a portion of RAM containing a bitmap that drives a video display, containing a complete frame of pixel data. 3) Flood fill and boundary fill algorithms were differentiated based on how the target region is defined and the recursion termination condition. Flood fill explicitly specifies all pixels while boundary fill uses pixels on the region boundary, and recursion terminates when a pixel doesn't match the original color for boundary fill but may terminate when a pixel has either fill or boundary color for flood fill.

Uploaded by

neha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views

University of Petroleum and Energy Studies: School of Computer Science

This document contains solutions to questions from a mid-semester examination in Computer Graphics. 1) A monochrome display with a resolution of 1280x1024 pixels would require 160 KB of memory. 2) A frame buffer is a portion of RAM containing a bitmap that drives a video display, containing a complete frame of pixel data. 3) Flood fill and boundary fill algorithms were differentiated based on how the target region is defined and the recursion termination condition. Flood fill explicitly specifies all pixels while boundary fill uses pixels on the region boundary, and recursion terminates when a pixel doesn't match the original color for boundary fill but may terminate when a pixel has either fill or boundary color for flood fill.

Uploaded by

neha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name:

Enrolment No:

UNIVERSITY OF PETROLEUM AND ENERGY STUDIES


School of Computer Science
Mid Semester Examination, October 2019 - SOLUTION
Course : Computer Graphics Semester : 5th
Program : B.Tech. (CSE) Time : 01 Hour
(CCVT/GG/MFT/Big Data/BFSI/ BAO/CSF/OSS/DevOps)
Course Code : CSEG3003 Max. Marks: 20
SECTION A
Q1 How much memory would be required to design a 1280×1024 pixels monochrome display?

Ans A monochrome display would require 1-bit per pixel to specify either of the two (black or white) colors.
Therefore,
Memory required = 1280×1024×1 bits
= 10×27×210 bits
= 160 KB
Evaluation suggestion:
Any answer in terms of number of bytes is acceptable. However, flat answer in terms of bits may cause
deduction of ½ marks.

Q2 Define a frame buffer.

Ans. A framebuffer is a portion of RAM containing a bitmap that drives a video display. It is a memory
buffer containing a complete frame of data.
Evaluation suggestion:
Instructor’s discretion.

Q3 Differentiate between Flood Fill and Boundary Fill region filling algorithms essentially on the following
parameters: (i) Target region definition (ii) Recursion termination condition
Flood Fill Boundary Fill
Target Region Target region is defined by totality of Target region is defined by pixels
Definition pixels. All pixels are explicitly lying on the boundary of the region.
specified. The boundary of a region R is the set
of pixels in the region that have one
or more neighbors that are not in R
Recursion Recursion ends when a pixel is Recursion comes to an end when a
termination encountered which has either fill pixel is encountered which doesn’t
condition color or boundary color. have region’s original color
Evaluation suggestion:
On parameter 1, definition by students may vary. Therefore, it is up to instructor’s discretion.
On parameter 2, criteria must match. No other way to end the recursion.

Q4 Specify the conditions to identify the line segments under ‘invisible’ and ‘partially-visible’ categories
for Cohen-Sutherland clipping algorithm.

Ans For invisible lines, bitwise AND of the endpoint region codes is not 0000.
For partially visible lines, bitwise AND of the endpoint region codes is 0000.

Evaluation suggestion:
Whichever format student has used to state, intentions must align. (full marks or no marks)

SECTION B

Q5 Scan convert a circle represented through an equation (y-5)2+(x-10)2 = 64 for the first quadrant using mid-
point algorithm. Indicate all coordinates in tabular form with corresponding calculations.

Ans Algorithm midpoint will contain two setpixel() calls:


setPixel( x+Xc, y+Yc);
setPixel( y+Xc, x+Yc);

With Xc = 10 and Yc = 5, and r = 8, iterations for midpoint circle algorithm are given below:

x, y p setPixel() setPixel() reflection


0, 8 -7 (10, 13) (18, 5)
1, 8 -4 (11, 13) (18, 6)
2, 8 1 (12, 13) (18, 7)
3, 7 -6 (13, 12) (17, 8)
4, 7 3 (14, 12) (17, 9)
5, 6 2 (15, 11) (16, 10)
6, 5 5

Evaluation suggestion:
There could be the cases that student finds origin centered circle’s coordinates correctly but incorrect
final points.
Correct origin and (10, 5) centered points but wrong reflection/symmetry points - 5
Correct origin but wrong (10, 5) centered points - 4
Rest, instructor’s discretion
Q6 Apply 2-D reflection over a triangle ABC with vertices A(5, 1), B(8, 3), and C(10, 1) about a straight line
PQ. Line PQ can be formed by applying rotation over a straight line Y= −𝑋 through an angle of 75
degrees in anticlockwise direction.

Ans Line PQ is obtained by rotating Y= −𝑋 anticlockwise through 75 degrees. Thus, PQ makes 30 degrees
angle with positive x-axis. To take reflection of ABC in x-axis, first PQ must be rotated clockwise by 30
degrees. Since it does not intersect either of the axes, translation is not required. The reflection about PQ
is given as
𝑀𝑝𝑞 = 𝑅30° . 𝑀𝑥 . 𝑅−30°

√3 1 √3 1 1 √3
−2 0 1 0 0 0 0
2 2 2 2 2
𝑀𝑝𝑞 = 1 √3 . [0 −1 0] . 1 √3 = √3 1
0 − 0 − 0
2 2 0 0 1 2 2 2 2
[0 0 1] [0 0 1] [0 0 1]

1 √3 5 + √3
0 5
2 2 2
𝐴′ = √3 1 . [1] = 5√3 − 1
− 0 1
2 2 2
[0 0 1] [ 1 ]

1 √3 8 + 3√3
0 8
2 2 2
𝐵 ′ = √3 1 . [ 3] = 8√3 − 3
− 0 1
2 2 2
[0 0 1] [ 1 ]

1 √3 10 + √3
0 10
2 2 2
𝐶 ′ = √3 1 . [ 1 ] = 10√3 − 1
− 0 1
2 2 2
[0 0 1] [ 1 ]

5+√3 5√3 −1 8+3√3 8√3 −3 10+√3 10√3 −1


Thus transformed triangle vertices are ( , ), ( , ), and ( , ).
2 2 2 2 2 2

Evaluation suggestion:
It is possible that many of the students would not interpret line PQ correctly. However, if they have
written the some composite transformation in right order, they may be given 4 marks. My suggestion are
as follows. Nevertheless, it is finally discretion of instructor as cases vary from student to student.
Correct transformation application with numerical error(s) – 5
Wrong interpretation of the line but correct sequence of transforms – 4
Done something in own context - 3

You might also like