CGR Model Answer Paper Summer 2023
CGR Model Answer Paper Summer 2023
CGR Model Answer Paper Summer 2023
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.
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
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
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.
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
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.
Page No: 4 | 27
Page No: 5 | 27
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.
Ans Various types of parallel projections are shown in the following hierarchy. Orthograph
ic
projection
explanation
with
example -
Page No: 6 | 27
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
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.
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
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:
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
(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
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.
Ans Steps 1: Read the end points of line (x1,y1) and (x2,y2) Correct
algorithm-
Steps 2: x = abs (x2 – x1) 4M
and
Step 3:
Page No: 10 | 27
then
length = x
else
length = y
end if
Step 6:
Step 7:
i = 1 while (i length)
x = x + x
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
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
1) Translate P1 to origin.
2) Rotate
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
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
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
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
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
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();
}
a) Describe following : 4M
Virtual reality apps allow us to explore the places that we have never been to, such as the
Page No: 15 | 27
• 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.
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
• 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.
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.
Page No: 17 | 27
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
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
a) Use Bresenham’s line drawing algorithm to rasterize line from (6, 5) to (15, 10). 6M
Page No: 20 | 27
Page No: 21 | 27
Ans Correct
solution -
6M
c) Obtain the curve parameters for drawing a smooth Bezier curve for the 6M
Page No: 22 | 27
Ans Correct
solution-
6M
Page No: 23 | 27
Page No: 24 | 27
a) Write boundary fill algorithm and flood fill algorithm with pseudo code. 6M
Page No: 25 | 27
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,
(60-30)
Page No: 26 | 27
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