CGR Model Answer Paper Summer 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

lOMoARcPSD|32704947

22318 CGR Model Answer Paper Summer 2023

Computer Engineering (Government Polytechnic, Nagpur)

Studocu is not sponsored or endorsed by any college or university


Downloaded by Nitin Surwadkar ([email protected])
lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
SUMMER – 2023 EXAMINATION
Model Answer – Only for the Use of RAC Assessors

Subject Name: Computer Graphics Subject Code: 22318


Important Instructions to examiners: XXXXX
1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme.
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.
3) The language errors such as grammatical, spelling errors should not be given more Importance (Not applicable for
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
+Marathi), the Examiner shall consider the same and assess the answer based on matching of concepts with model
answer.

Q. Sub Answer Marking


No. Q. Scheme
N.

1 Attempt any FIVE of the following: 10 M

a) Define : 2M
(i) Pixel
(ii) Frame Buffer

Ans i) Pixel 1 M each


for any
Pixel or Pel is defined as "the smallest addressable screen element". correct
OR definition

A pixel may be defined as the smallest size object or color spot that can be displayed and
addressed on a monitor.
ii) Frame Buffer
The frame buffer is the video memory (RAM) that is used to hold or map the image
displayed on the screen.
OR
A framebuffer (frame buffer, or sometimes framestore) is a portion of RAM containing a
bitmap that drives a video display.

Page No: 1 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
b) Define : 2M
(i) Convex Polygon
(ii) Concave polygon
Ans Convex Polygon: It is a polygon in which if you take any two positions of polygon then all 1 M each
the points on the line segment joining these two points fall within the polygon itself. for correct
Concave Polygon: It is a polygon in which if you take any two positions of polygon then definition
all the points on the line segment joining these two points does not fall entirely within the
polygon.

c) Write matrix representation for X-shear and Y-shear 2M

Ans Shearing in X Axis- X-shear


Matrix –
Shearing in X axis is achieved by using the following shearing equations-
1 M,
Xnew = Xold + Shx x Yold
Y-shear
Ynew = Yold
Matrix –
1M

Shearing in Y Axis-
Shearing in Y axis is achieved by using the following shearing equations-
Xnew = Xold
Ynew = Yold + Shy x Xold

Page No: 2 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

d) List any four display devices. 2M

Ans 1) Raster Scan Display Any 4


correct
2) Random Scan Display display
devices -
3) Liquid crystal display(LCD)
2M
4) Light Emitting Diode(LED)
5) Plasma Display
6) Touch Screen display

e) State any four general criteria applied for any line drawing algorithm. 2M

Ans There are the following general criteria of Line Drawing Algorithm. Any 4
correct
1) An algorithm should be precise: Each step of the algorithm must be adequately criteria –
defined. 2M
2) Finiteness: An algorithm must contain finiteness. It means the algorithm stops after
the execution of all steps.
3) Easy to understand: An algorithm must help learners to understand the solution in a
more natural way.
4) Correctness: An algorithm must be in the correct manner.
5) Effectiveness: The steps of an algorithm must be valid and efficient.
6) Uniqueness: All steps of an algorithm should be clearly and uniquely defined, and
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.

f) List any four properties of homogeneous co-ordinate system. 2M

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

Page No: 3 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
points in euclidean space means matrix multiplication.

3) Homogeneous coordinate systems mean expressing each coordinate as a homogeneous


coordinate to represent all geometric transformation equations as matrix multiplication.

4) The restricted form of homogeneous coordinate is also valuable in computer graphics it


solves problems in representing and implementing transformations of geometric objects.

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.

6) Homogeneous coordinates are ubiquitous in computer graphics because they allow


common vector operations such as translation, rotation, scaling and perspective projection
to be represented as a matrix by which the vector is multiplied.

g) Give any four applications of computer graphics. 2M

Ans Applications of Computer Graphics Any 4


correct
• Computer graphics user interfaces (GUIs) − A graphic, mouse-oriented paradigm applications
which allows the user to interact with a computer. -2M
• Business presentation graphics −""A picture is worth a thousand words""
• Cartography − Drawing maps.
• Weather Maps −Real-time mapping, symbolic representations.
• Satellite Imaging − Geodesic images.
• Photo Enhancement − Sharpening blurred photos.
• Medical imaging − MRIs, CAT scans, etc. - Non-invasive internal examination.
• Engineering drawings − mechanical, electrical, civil, etc. - Replacing the blueprints
of the past.
• Architecture − Construction plans, exterior sketches - replacing the blueprints and
hand drawings of the past.
• Art − Computers provide a new medium for artists.
• Entertainment − Movies and games.
• Simulation and modeling−Replacing physical modeling and enactments

2. Attempt any THREE of the following: 12 M

a) Differentiate between random scan and raster scan. 4M

Page No: 4 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Ans Any 4
correct
Difference-
4M
(each
difference-
1 M)

b) State different character generation method. Describe any one in detail. 4M

Ans There are basic three methods: Listing


– Stroke method three
– Starbust method Methods –
– Bitmap method 1M,
1. Stroke method
• This method uses small line segments to generate a character. Any One
• The small series of line segments are drawn like a stroke of a pen to form a character as correct
shown in figure. description-
3M

• We can build our own stroke method.


• By calling a line drawing algorithm.
• Here it is necessary to decide which line segments are needed for each character and
• Then drawing these segments using line drawing algo.
• This method supports scaling of the character.
• It does this by changing the length of the line segments used for character drawing.

Page No: 5 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
2. Starbust method
• In this method a fix pattern of line segments are used to generate characters.
• As shown in figure, there are 24 line segments.
• Out of 24 line segments, segments required to display for particular character, are
highlighted
• This method is called starbust method because of its characteristic appearance. This
method of character generation has some disadvantages. They are
1. The 24-bits are required to represent a character. Hence more memory is required
2. Requires code conversion software to display character from its 24-bit code
3. Character quality is poor. It is worst for curve shaped characters.

3. Bitmap Method: Also known as dot matrix because in this method characters are
represented by an array of dots in the matrix form.
• It’s a two dimensional array having columns and rows: 5 X 7 as shown in figure.
• 7 X 9 and 9 X 13 arrays are also used.
• Higher resolution devices may use character array 100 X 100.

c) Explain types of parallel projections with examples. 4M

Ans Various types of parallel projections are shown in the following hierarchy. Orthograph
ic
projection
explanation
with
example -

Page No: 6 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
2 M,
Oblique
projection
explanation
with
example-
2M

Orthographic Projection
• In orthographic projection the direction of projection is normal to the projection of the
plane.
• There are three types of orthographic projections −
– Front Projection
– Top Projection
– Side Projection

Oblique Projection
• In oblique projection, we can view the object better than orthographic projection.
• There are two types of oblique projections − Cavalier and Cabinet.
• The Cavalier projection makes 45° angle with the projection plane.
• The projection of a line perpendicular to the view plane has the same length as the line
itself in Cavalier projection.
• In a cavalier projection, the foreshortening factors for all three principal directions are
equal.
• 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 –

Page No: 7 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

d) Describe Sutherland Hodgeman algorithm for polygon clipping. 4M

Ans In Sutherland-Hodgeman, a polygon is clipped by processing the polygon boundary as a Explanation


whole against each window edge. Clipping window must be convex. -1M
and
This could be accomplished by processing all polygon vertices against each clip rectangle Algorithm-
boundary in turn beginning with the original set of polygon vertices, first clip the polygon 3M
against the left rectangle boundary to produce a new sequence of vertices.

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.

Fig. Clipping polygon against successive window boundaries

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.

This is achieved by processing two vertices of each edge of the polygon around the
clipping boundary or plane.

This results in four possible relationships between the edge and clipping plane.

Case 1. If first vertex of polygon edge is outside and second is inside window boundary,
then intersection point of polygon edge with window boundary and second vertex are added
to output vertices set as shown in Fig.

Page No: 8 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

Case 2. If both vertices of edge are inside window boundary, then add only second vertex to
output set as shown in Fig.

Case 3. If first vertex of edge is inside and second is outside of window boundary then point
of intersection of edge with window boundary is stored in output set as shown in Fig.

Case 4. If both vertices of edges are outside of window boundary then those vertices are
rejected as shown in Fig.

Going through above four cases we can realize that there are two key processes in this
algorithm:

1. Determine the visibility of point or vertex (Inside – Outside Test)

2. Determine the intersection of the polygon edge and clipping plane.

The second key process in Sutherland-Hodgeman polygon clipping algorithm is to


determine the intersection of the polygon edge and clipping plane.

Assume that we're clipping a polygon’s edge with vertices at (x1, y1) and (x2, y2) against a
clip window with vertices at (xmin, ymin) and (xmax, ymax).

1. The location (IX, IY) of the intersection of the edge with the left side of the

window is:

(i) IX = xmin

(ii) IY = slope*(xmin – x1) + y1, where the slope = (y2 – y1)/(x2 – x1).

2. The location of the intersection of the edge with the right side of the

Page No: 9 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
window is:

(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:

(i) IX = x1 + (ymax – y1) / slope

(ii) IY = ymax

4. Finally, the intersection of the edge with the bottom side of the window is:

(i) IX = x1 + (ymin – y1) / slope

(ii) IY = ymin

Algorithm for Sutherland-Hodgeman Polygon Clipping:

Step 1: Read co-ordinates of all vertices of the polygon.

Step 2: Read co-ordinates of the clipping window.

Step 3: Consider the left edge of window.

Step 4: Compare vertices of each of polygon, individually with the clipping plane.

Step 5: Save the resulting intersections and vertices in the new list of vertices according to
four possible relationships between the edge and the clipping boundary.

Step 6: Repeat the steps 4 and 5 for remaining edges of clipping window. Each time
resultant list of vertices is successively passed to process next edge of clipping window.

Step 7: Stop.

3. Attempt any THREE of the following: 12 M

a) Write and explain steps for DDA Line drawing algorithm. 4M

Ans Steps 1: Read the end points of line (x1,y1) and (x2,y2) Correct
algorithm-
Steps 2: x = abs (x2 – x1) 4M

and

y = abs (y2 – y1)

Step 3:

Page No: 10 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
if x  y

then

length = x

else

length = y

end if

Step 4: x = (x2 – x1)/length

Step 5: y = (y2 – y1)/length

Step 6:

x= x1 + 0.5 * sign (x)

y= y1 + 0.5 * sign (y)

Step 7:

i = 1 while (i  length)

plot (integer (x), integer (y))

x = x + x

y = y + y

i=i+1

Step 8: End

b) Describe 2D transformation matrix for rotation about arbitrary point 4M

Ans To do rotation of an object about any selected arbitrary point P1(x1, y1); following Explanation
sequence of operations shall be performed. - 3 M,
Matrix-
1. Translate: Translate an object so that arbitrary point P1 is moved to coordinate origin. 1 M,
Diagram-
2. Rotate: Rotate object about origin. 1M

3. Translate: Translate object so that arbitrary point P1 is moved back to its original
position.
Page No: 11 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Rotate about point P1(x1, y1).

1) Translate P1 to origin.

2) Rotate

3) Translate back to P1.

Equation for this composite transformation matrix form is as follows:

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

It is demonstrated in following figure :

c) Explain any two text clipping methods. 4M

Ans Many techniques are used to provide text clipping in a computer graphics. It depends on Any two
the methods used to generate characters and the requirements of a particular application. method
There are three methods for text clipping which are listed below – explanation
1) All or none string clipping 4M
(2 M each)
2) All or none character clipping

Page No: 12 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
3) Text clipping

The following figure shows all or none string clipping –

In all or none string clipping method, either we keep the entire string or we reject entire
string based on the clipping window. As shown in the above figure, STRING2 is entirely
inside the clipping window so we keep it and STRING1 being only partially inside the
window, we reject.
The following figure shows all or none character clipping –

This clipping method is based on characters rather than 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 the string being outside If the character is on the boundary
of the clipping window, then we discard that entire character and keep the rest string.
The following figure shows text clipping –

Page No: 13 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

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
is outside of the clipping window.
d) Write C program to generate Hilbert’z Curve. 4M

Ans #include <stdio.h> Any correct


#include <stdlib.h> logic
#include <dos.h> program-
#include <graphics.h> 4M
#include <conio.h>

void move(int j, int h, int &x, int &y)


{
if(j==1)
y-=h;
else if(j==2)
x+=h;
else if(j==3)
y+=h;
else if(j==4)
x-=h;
lineto(x,y);
delay(10);
}

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: 14 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
move(r,h,x,y);
hilbert(r,d,l,u,i,h,x,y);
move(d,h,x,y);
hilbert(r,d,l,u,i,h,x,y);
move(l,h,x,y);
hilbert(u,l,d,r,i,h,x,y);
}
}

void main()
{
int n,x1,y1;
int x0=50,y0=150,x,y,h=10,r=2,d=3,l=4,u=1;
printf("\nGive the value of n: ");
scanf("%d",&n);
x=x0;y=y0;
int gm,gd=DETECT;
initgraph(&gd,&gm,NULL);
moveto(x,y);
hilbert(r,d,l,u,n,h,x,y);
getch();
closegraph();
}

4. Attempt any THREE of the following: 12 M

a) Describe following : 4M

(i) Virtual Reality


(ii) Augmented Reality

Ans i) Virtual Reality: Virtual


Reality-
It is a very important and interesting term. The terms 'Virtual' refers to something 2 M,
conceptual that does not have its physical existence, and the word 'reality refers to the state Augmented
of being real. So, virtual reality means something that is almost real. It is defined as the Reality -
creation of a simulated environment by using computer technology. Viewing virtual reality 2M
means viewing a completely different reality than the one in front of you. It can be artificial,
like an animated scene or a place which is photographed and integrated in a virtual reality
app. It enables us to move around and look in every direction - up, down, sideways, and
behind, as we are present there actually.

Virtual reality apps allow us to explore the places that we have never been to, such as the

Page No: 15 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Mars surface, the top of Mt. Everest, areas deep under the sea, and many more things that
we can imagine only. It uses three of our senses: hearing, touching, seeing, to trick the brain
into thinking that we are at a different place.

Advantages of Virtual Reality:

• 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.
• It allows users to do an experiment in an artificial environment.
• It increases the work capabilities.
• Virtual reality is helpful for medical students to do practice well. It will be helpful
for patients, too, as it offers a safe environment to them by which a patient can come
into contact with the things they fear.
• Virtual reality helps to measure the performance of sportsperson and analyze their
techniques.
Disadvantages of Virtual Reality:

• Using VR, people start ignoring the real world. They started living in the virtual
world instead of dealing with the issues of the real world.
• Training in the virtual environment does not have the same result as training in the
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.

ii) Augmented Reality:

The word "Augmented" means to add. It is created by using the technology by adding
digital information to an image or something. Augmented reality is an important concept
and impacts our lives deeply. It provides an improved version of reality as it uses different
tools to make the environment existing and real. Augmented reality gives you an interactive
experience of the real-world environment. It keeps you in your place and superimposes the
technology in the form of text, sounds, and images.

Augmented reality merges the physical world with computer-generated virtual elements. It
is accessed using common equipment such as mobile phones. There are nearly uncountable
possibilities with the Augmented Reality. With the smartphone's camera, AR adds the
digital elements to a live view. It uses the smartphone's camera to present the real world's
view in front of us and then put a layer of information that includes the text or images on
the top of that view. Some of the examples of Augmented Reality are the Pokémon Go
game, Snapchat lenses.

Page No: 16 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Advantages of Augmented Reality

The advantages of Augmented Reality are listed as follows -

• It increases accuracy.
• It offers innovation, continuous improvement, and individualized learning.
• It helps developers to build games that offer real experiences.
• It enhances the knowledge and information of the user.

Disadvantages of Augmented Reality

• Projects based on AR technology are expensive to implement and develop.


• Excessive use of augmented reality technology can lead to eye problems, obesity,
etc.
• It can cause mental health issues.

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.

1. Odd-Even Rule:
In this technique, we count the edge crossing along the line from any point (x, y) to
infinity. If the number of interactions is odd then the point (x, y) is an interior point. If the
number of interactions is even then point (x, y) is an exterior point.
Here is the example to give you the clear idea,

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.

2. Non-zero Winding Number Rule:

Page No: 17 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
This method is also used with the simple polygons to test the given point is interior or not.
It can be simply understood with the help of a pin and a rubber band.
Fix up the pin on one of the edge of the polygon and tie-up the rubber band in it and then
stretch the rubber band along the edges of the polygon.
When all the edges of the polygon are covered by the rubber band, check out the pin
which has been fixed up at the point to be test. If we find at least one wind at the point
consider it within the polygon, else we can say that the point is not inside the polygon.

Fig b: Non-zero Winding Number Rule

In another alternative method, give directions to all the edges of the polygon. Draw a scan
line from the point to be test towards the left most of X direction. Given the value 1 to all
the edges which are going to upward direction and all other – 1 as direction values.
Check the edge direction values from which the scan line is passing and sumup them.
If the total sum of this direction value is non-zero, then this point to be tested is an interior
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

Page No: 18 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
It specifies three co-ordinates with their own scaling factors. If scale factors,Sx = Sy = Sz =
S > 1 then the scaling is called as magnification.
Sx = Sy = Sz = S < 1 then the scaling is called as reduction.
Therefore, point after scaling with respect to origin can be calculated as,P=P . S

d) Write down Cyrus Beck Line clipping algorithm. 4M

Ans Any correct


logic
Proper
algorithm
4 Marks

d) Explain curve generation using interpolation techniques. 4M

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.

Page No: 19 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

5. Attempt any TWO of the following: 12 M

a) Use Bresenham’s line drawing algorithm to rasterize line from (6, 5) to (15, 10). 6M

Page No: 20 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Ans Calculation
s of dx, dy
and p- 2 M;
Calculation
s of steps-
4M

Page No: 21 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

b) Perform 2D scaling transformation on square ABCD with coordinates 6M


(0,1),(4,1),(4,5),(0,5) by 3 units for X-direction and 2 units in y-direction.

Ans Correct
solution -
6M

c) Obtain the curve parameters for drawing a smooth Bezier curve for the 6M

Page No: 22 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
following points A(0,10), B(10,50), C(70,40) &D(70,-20).

Ans Correct
solution-
6M

Page No: 23 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

Page No: 24 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

6. Attempt any TWO of the following: 12 M

a) Write boundary fill algorithm and flood fill algorithm with pseudo code. 6M

Ans Boundary fill algorithm: Boundary


fill- 3 M,
boundaryFill(int x, int y, int fill_color,int boundary_color) and Flood
{ Fill
if(getpixel(x, y) != boundary_color && algorithm-
getpixel(x, y) != fill_color) 3M
{
putpixel(x, y, fill_color);
boundaryFill(x + 1, y, fill_color, boundary_color);
boundaryFill(x, y + 1, fill_color, boundary_color);
boundaryFill(x - 1, y, fill_color, boundary_color);
boundaryFill(x, y - 1, fill_color, boundary_color);
}
}

Flood fill Algorithm:

floodfill (x, y,fill_ color, old_color)


If (getpixel (x, y)=old_color)
{
setpixel (x, y, fill_color);
fill (x+1, y, fill_color, old_color);
fill (x-1, y, fill_color, old_color);
fill (x, y+1, fill_color, old_color);
fill (x, y-1, fill_color, old_color);
}
}
b) Show the transformation matrix for a reflection about the line Y=X is 6M
equivalent to reflection about X-axis followed by counter clockwise rotation of
90°.

Page No: 25 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Ans The Transformation matrix for reflection about the line y=x is given as: Transforma
tion matrix
for
0 1 reflection -
1 0 2 M,
Counter
clockwise
rotation
The transformation matrix for reflection about x-axis and for counter clockwise rotation of matrix -
900 2 M,
final
answer -
2M
1 0 and cos(90) sin(90)

0 -1 -sin(90) cos(90)

Hence,

T= 1 0 0 1

0 -1 -1 0

= 0 1

1 0

c) Apply the Liang-Barsky algorithm to the line with co-ordinates (30,60) and (60,25) 6M
against window :
(Xmin, Ymin) = (10,10)
(Xmax,Ymax) = (50,50)
Ans P = (30 , 60) Slope
calculation
Q = (60 , 25) - 2 M,

(Xmin , Ymin) = (10 , 10) Point P


calculation
(Xmax , Ymax) = (50 , 50) – 2 M,
Slope of line PQ Point Q
calculation
m = (y₂ – y₁)
–2M
(x₂ – x₁)
m = (25-60)

(60-30)

Page No: 26 | 27

Downloaded by Nitin Surwadkar ([email protected])


lOMoARcPSD|32704947

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION


(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
m = -35/30

m = -1.16

x = x₁ + (y – y₁) / m

x = 30 + (50 - 60) / (-1.16)

x = 30 + (-10) / (-1.16)

x = 30 + 8.6

x = 38.6

The coordinate of intersection point is P⁻ (38.6 , 50).

y = y₁ + m(x – x₁)
y = 25 + (-1.16)(50 - 60)

y = 25 + 11.6

y = 36.6

The coordinate of intersection point is Q⁻ (50 , 36.6).

Page No: 27 | 27

Downloaded by Nitin Surwadkar ([email protected])

You might also like