CGR - Summer 2023 Ans-Paper
CGR - Summer 2023 Ans-Paper
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________ __________________________________________________________________________________________________
SUMMER – 2023 EXAMINATION b) Define : 2M
Model Answer – Only for the Use of RAC Assessors (i) Convex Polygon
Subject Name: Computer Graphics Subject Code: (ii) Concave polygon
22318
Ans Convex Polygon: It is a polygon in which if you take any two positions of polygon then all 1 M each
Important Instructions to examiners: XXXXX the points on the line segment joining these two points fall within the polygon itself. for correct
1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. definition
Concave Polygon: It is a polygon in which if you take any two positions of polygon then
2) The model answer and the answer written by candidate may vary but the examiner may try to assess the
understanding level of the candidate. all the points on the line segment joining these two points does not fall entirely within the
3) The language errors such as grammatical, spelling errors should not be given more Importance (Not applicable for polygon.
subject English and Communication Skills.
4) While assessing figures, examiner may give credit for principal components indicated in the figure. The figures
drawn by candidate and model answer may vary. The examiner may give credit for any equivalent figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed constant values may vary and
there may be some difference in the candidate’s answers and model answer.
6) In case of some questions credit may be given by judgement on part of examiner of relevant answer based on
candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on equivalent concept.
8) As per the policy decision of Maharashtra State Government, teaching in English/Marathi and Bilingual (English +
Marathi) medium is introduced at first year of AICTE diploma Programme from academic year 2021-2022. Hence if
the students in first year (first and second semesters) write answers in Marathi or bilingual language (English c) Write matrix representation for X-shear and Y-shear 2M
+Marathi), the Examiner shall consider the same and assess the answer based on matching of concepts with model
answer. Ans Shearing in X Axis- X-shear
Matrix –
Shearing in X axis is achieved by using the following shearing equations-
Q. Sub Answer Marking 1 M,
No. Q. Scheme Xnew = Xold + Shx x Yold
N. Y-shear
Ynew = Yold
Matrix –
1 Attempt any FIVE of the following: 10 M 1M
a) Define : 2M
(i) Pixel
(ii) Frame Buffer
A pixel may be defined as the smallest size object or color spot that can be displayed and
addressed on a monitor. Shearing in Y Axis-
ii) Frame Buffer Shearing in Y axis is achieved by using the following shearing equations-
Xnew = Xold
The frame buffer is the video memory (RAM) that is used to hold or map the image
displayed on the screen. Ynew = Yold + Shy x Xold
OR
A framebuffer (frame buffer, or sometimes framestore) is a portion of RAM containing a
bitmap that drives a video display.
5) Most graphics are represented by matrices, and applied for vectors in cartesian form, by
taking vectors as column vectors and multiplying them by the transformation’s matrix.
d) List any four display devices. 2M
6) Homogeneous coordinates are ubiquitous in computer graphics because they allow
Ans 1) Raster Scan Display Any 4 common vector operations such as translation, rotation, scaling and perspective projection
correct to be represented as a matrix by which the vector is multiplied.
2) Random Scan Display display
devices - g) Give any four applications of computer graphics. 2M
3) Liquid crystal display(LCD)
2M
4) Light Emitting Diode(LED) Ans Applications of Computer Graphics Any 4
correct
5) Plasma Display • Computer graphics user interfaces (GUIs) − A graphic, mouse-oriented paradigm applications
which allows the user to interact with a computer. -2M
6) Touch Screen display
• Business presentation graphics −""A picture is worth a thousand words""
e) State any four general criteria applied for any line drawing algorithm. 2M • Cartography − Drawing maps.
• Weather Maps −Real-time mapping, symbolic representations.
Ans There are the following general criteria of Line Drawing Algorithm. Any 4 • Satellite Imaging − Geodesic images.
correct
• Photo Enhancement − Sharpening blurred photos.
1) An algorithm should be precise: Each step of the algorithm must be adequately criteria –
defined. 2M • Medical imaging − MRIs, CAT scans, etc. - Non-invasive internal examination.
2) Finiteness: An algorithm must contain finiteness. It means the algorithm stops after • Engineering drawings − mechanical, electrical, civil, etc. - Replacing the blueprints
the execution of all steps. of the past.
3) Easy to understand: An algorithm must help learners to understand the solution in a • Architecture − Construction plans, exterior sketches - replacing the blueprints and
more natural way. hand drawings of the past.
4) Correctness: An algorithm must be in the correct manner. • Art − Computers provide a new medium for artists.
5) Effectiveness: The steps of an algorithm must be valid and efficient. • Entertainment − Movies and games.
6) Uniqueness: All steps of an algorithm should be clearly and uniquely defined, and • Simulation and modeling−Replacing physical modeling and enactments
the result should be based on the given input.
7) Input: A good algorithm must accept at least one or more input.
8) Output: An algorithm must generate at least one output. 2. Attempt any THREE of the following: 12 M
f) List any four properties of homogeneous co-ordinate system. 2M a) Differentiate between random scan and raster scan. 4M
Ans 1) Homogeneous coordinates will have some neutral applications in computer graphics, Any 4
they form the basis for geometry which is used extensively to display three-dimensional correct
objects on two-dimensional image planes. properties -
2M
2) Homogeneous coordinate provides a standard to perform certain standard operations on
The new set of vertices could then be successively passed to a right boundary clipper, a top
boundary clipper and a bottom boundary clipper.
At each step a new set of polygon vertices us generated and passed to the next window
boundary clipper. This is the logic used in Sutherland-Hodgeman algorithm.
The output of algorithm is a list of polygon vertices all of which are on the visible side of
clipping plane. Such each edge of the polygon is individually compared with the clipping
plane.
Oblique Projection This is achieved by processing two vertices of each edge of the polygon around the
• In oblique projection, we can view the object better than orthographic projection.
clipping boundary or plane.
• There are two types of oblique projections − Cavalier and Cabinet.
• The Cavalier projection makes 45° angle with the projection plane. This results in four possible relationships between the edge and clipping plane.
• The projection of a line perpendicular to the view plane has the same length as the line
itself in Cavalier projection. Case 1. If first vertex of polygon edge is outside and second is inside window boundary,
• In a cavalier projection, the foreshortening factors for all three principal directions are then intersection point of polygon edge with window boundary and second vertex are added
equal.
to output vertices set as shown in Fig.
• The Cabinet projection makes 63.4° angle with the projection plane.
• In Cabinet projection, lines perpendiculars to the viewing surface are projected at ½ their
actual length.
• Both the projections are shown in the following figure –
(i) IX = xmax
(ii) IY = slope*(xmax – x1) + y1, where the slope = (y2 – y1)/(x2 – x1)
3. The intersection of the polygon's edge with the top side of the window is:
(ii) IY = ymax
4. Finally, the intersection of the edge with the bottom side of the window is:
(ii) IY = ymin
1. The location (IX, IY) of the intersection of the edge with the left side of the Ans Steps 1: Read the end points of line (x1,y1) and (x2,y2) Correct
algorithm-
window is: Steps 2: x = abs (x2 – x1) 4M
(ii) IY = slope*(xmin – x1) + y1, where the slope = (y2 – y1)/(x2 – x1). y = abs (y2 – y1)
2. The location of the intersection of the edge with the right side of the Step 3:
length = x 2) Rotate
end if
Step 6:
x= x1 + 0.5 * sign (x) Here (x1,y1) are coordinates of point P1 and hence are translation factors tx and ty; we want
to move P1 to origin , x1 and y1 are x and y distances to P1and hence it is translation factor
y= y1 + 0.5 * sign (y)
Step 7:
i = 1 while (i length)
y = y + y
i=i+1
Step 8: End
Ans To do rotation of an object about any selected arbitrary point P1(x1, y1); following Explanation c) Explain any two text clipping methods. 4M
sequence of operations shall be performed. - 3 M,
Matrix- Ans Many techniques are used to provide text clipping in a computer graphics. It depends on Any two
1. Translate: Translate an object so that arbitrary point P1 is moved to coordinate origin. 1 M, the methods used to generate characters and the requirements of a particular application. method
Diagram- There are three methods for text clipping which are listed below – explanation
2. Rotate: Rotate object about origin. 1M 1) All or none string clipping 4M
(2 M each)
3. Translate: Translate object so that arbitrary point P1 is moved back to its original 2) All or none character clipping
position.
Page No: 11 | 27 Page No: 12 | 27
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________ __________________________________________________________________________________________________
3) Text clipping
This clipping method is based on characters rather than the entire string. In this method if
the string is entirely inside the clipping window, then we keep it. If it is partially outside
the window, then you reject only the portion of string being outside. If the character is on
the boundary of the clipping window, then we discard only that portion of character that
In all or none string clipping method, either we keep the entire string or we reject entire is outside of the clipping window.
string based on the clipping window. As shown in the above figure, STRING2 is entirely d) Write C program to generate Hilbert’z Curve. 4M
inside the clipping window so we keep it and STRING1 being only partially inside the
Ans #include <stdio.h> Any correct
window, we reject.
The following figure shows all or none character clipping – #include <stdlib.h> logic
#include <dos.h> program-
#include <graphics.h> 4M
#include <conio.h>
void hilbert(int r,int d,int l,int u,int i,int h,int &x,int &y)
{
if(i>0)
{
i--;
hilbert(d,r,u,l,i,h,x,y);
Page No: 13 | 27 Page No: 14 | 27
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________ __________________________________________________________________________________________________
move(r,h,x,y); Mars surface, the top of Mt. Everest, areas deep under the sea, and many more things that
hilbert(r,d,l,u,i,h,x,y); we can imagine only. It uses three of our senses: hearing, touching, seeing, to trick the brain
move(d,h,x,y); into thinking that we are at a different place.
hilbert(r,d,l,u,i,h,x,y);
move(l,h,x,y); Advantages of Virtual Reality:
hilbert(u,l,d,r,i,h,x,y); • It creates an interactive environment.
} • It helps us to explore the world by creating a realistic world using computer
} technology.
• It makes education comfortable and easy.
void main() • It allows users to do an experiment in an artificial environment.
{ • It increases the work capabilities.
int n,x1,y1; • Virtual reality is helpful for medical students to do practice well. It will be helpful
int x0=50,y0=150,x,y,h=10,r=2,d=3,l=4,u=1; for patients, too, as it offers a safe environment to them by which a patient can come
printf("\nGive the value of n: "); into contact with the things they fear.
scanf("%d",&n); • Virtual reality helps to measure the performance of sportsperson and analyze their
x=x0;y=y0; techniques.
int gm,gd=DETECT;
Disadvantages of Virtual Reality:
initgraph(&gd,&gm,NULL);
moveto(x,y); • Using VR, people start ignoring the real world. They started living in the virtual
hilbert(r,d,l,u,n,h,x,y); world instead of dealing with the issues of the real world.
getch(); • Training in the virtual environment does not have the same result as training in the
closegraph(); actual world.
} • It is not guaranteed that a person has done a task well in the real world if he/she has
performed that task well in the virtual world.
b) Explain Inside and Outside test for the polygon with suitable example. 4M
Ans This method is also known as counting number method. While filling an object, we often Explanation
need to identify whether particular point is inside the objector outside it. -4M
There are two methods by which we can identify whether particular point is inside an
object or outside namely, Odd-Even Rule, and Non-zero winding number rule. Fig b: Non-zero Winding Number Rule
In another alternative method, give directions to all the edges of the polygon. Draw a scan
1. Odd-Even Rule:
line from the point to be test towards the left most of X direction. Given the value 1 to all
In this technique, we count the edge crossing along the line from any point (x, y) to
the edges which are going to upward direction and all other – 1 as direction values.
infinity. If the number of interactions is odd then the point (x, y) is an interior point. If the
Check the edge direction values from which the scan line is passing and sumup them.
number of interactions is even then point (x, y) is an exterior point.
If the total sum of this direction value is non-zero, then this point to be tested is an interior
Here is the example to give you the clear idea,
point, otherwise it is an exterior point.
In the above figure, we sum up the direction values from which the scan line is passing
then the total is 1 – 1 + 1 = 1; which is non-zero. So the point is said to be an interior
point.
c) Describe 3D scaling along with its matrix representation. 4M
Ans Scaling means to change the size of object. This change can either be positive or negative. Description
- 2 M,
• To change the size of an object, scaling transformation is used. In the scaling Matrix-
process, you either expand or compress the dimensions of the object. 2M
• Scaling can be achieved by multiplying the original co-ordinates of the object with
the scaling factor to get the desired result.
3D Scaling Matrix
From the Fig., we can see that from the point (x, y), the number of interactions point on
the left side is 5 and on the right side is 3. So the total number of interaction point is 8,
which is odd. Hence, the point is considered within the object.
a) Use Bresenham’s line drawing algorithm to rasterize line from (6, 5) to (15, 10). 6M
Ans Specify a spline curve by giving a set of coordinate positions, called control points, which Diagram-
indicates the general shape of the curve These, control points are then fitted with 2 M,
piecewise continuous parametric polynomial functions in one of two ways. When
polynomial sections are fitted so that the curve passes through each control point, the Explanation
resulting curve is said to interpolate the set of control points. On the other hand, when the -2M
polynomials are fitted to the general control -point path without necessarily passing
through any control point, the resulting curve is said to approximate the set of control
points interpolation curves are commonly used to digitize drawings or to specify
animation paths. Approximation curves are primarily used as design tools to structure
object surfaces an approximation spline surface credited for a design application.
Straight lines connect the control -point positions above the surface.
Ans Correct
solution -
6M
c) Obtain the curve parameters for drawing a smooth Bezier curve for the 6M
Ans Correct
solution-
6M
a) Write boundary fill algorithm and flood fill algorithm with pseudo code. 6M
Hence,
Ans Boundary fill algorithm: Boundary
fill- 3 M, T= 1 0 0 1
boundaryFill(int x, int y, int fill_color,int boundary_color) and Flood
{ Fill 0 -1 -1 0
if(getpixel(x, y) != boundary_color && algorithm-
getpixel(x, y) != fill_color) 3M
{
putpixel(x, y, fill_color); = 0 1
boundaryFill(x + 1, y, fill_color, boundary_color);
boundaryFill(x, y + 1, fill_color, boundary_color); 1 0
boundaryFill(x - 1, y, fill_color, boundary_color);
boundaryFill(x, y - 1, fill_color, boundary_color);
} c) Apply the Liang-Barsky algorithm to the line with co-ordinates (30,60) and (60,25) 6M
} against window :
(Xmin, Ymin) = (10,10)
Flood fill Algorithm: (Xmax,Ymax) = (50,50)
Ans P = (30 , 60) Slope
floodfill (x, y,fill_ color, old_color) calculation
If (getpixel (x, y)=old_color) Q = (60 , 25) - 2 M,
{
setpixel (x, y, fill_color); (Xmin , Ymin) = (10 , 10) Point P
fill (x+1, y, fill_color, old_color); calculation
fill (x-1, y, fill_color, old_color);
(Xmax , Ymax) = (50 , 50) – 2 M,
fill (x, y+1, fill_color, old_color); Slope of line PQ Point Q
fill (x, y-1, fill_color, old_color);
calculation
} m = (y₂ – y₁)
} –2M
b) Show the transformation matrix for a reflection about the line Y=X is 6M (x₂ – x₁)
equivalent to reflection about X-axis followed by counter clockwise rotation of
m = (25-60)
90°.
(60-30)
m = -1.16
x = x₁ + (y – y₁) / m
x = 30 + (-10) / (-1.16)
x = 30 + 8.6
x = 38.6
y = y₁ + m(x – x₁)
y = 25 + (-1.16)(50 - 60)
y = 25 + 11.6
y = 36.6
Page No: 27 | 27