You are on page 1of 20

# St.JOSEPH’S COLLEGE OF ENGINEERING, CHENNAI-119.

MODEL EXAMINATION-I

## Subject : Graphics and Multimedia Code : CS1354

Branch : IT Semester : VII
Duration : 3Hours Max marks : 100

## Part - A (10 * 2 = 20)

1. What is the disadvantage of DDA Algorithm?
2. Mention the techniques used for producing color displays.
3. Mention the types of line caps.
4. Define tiling.
5. What is affine transformation? Give example.
6. What is vanishing point?
7. Define parallel projection.
8. What are called blobby objects? Give example.
9. What do you mean by the term chromaticity?
10.Define morphing.

Part - B (5 * 16 = 80)

## 11. a) Discuss the applications of computer graphics in detail. (16)

(OR)
b) Explain two dimensional transformations in detail. (16)

12. a) Explain any one line drawing method with an example. (16)
(OR)
b)Explain Sutherland Hodgman algorithm for polygon clipping. (16)

## 13. a)Explain Cohen Sutherland line clipping algorithm. (16)

(OR)
b)Explain midpoint ellipse algorithm in detail. (16)

## 14. a) Explain three dimensional display methods in detail. (16)

(OR)
b) Explain HSV and HLS color model in detail. (16)

## 15. a) Explain three dimensional object representations in detail. (16)

(OR)
b) Write short notes on
(i) Window to viewport coordinate transformation. (6)
(ii) Inside –Outside test (6)
(iii) Scan line polygon filling algorithm (4)
St.JOSEPH’S COLLEGE OF ENGINEERING, CHENNAI-119.
MODEL EXAMINATION-I

## Subject : Graphics and Multimedia Code : CS1354

Branch : IT Semester : VII
Duration : 3Hours Max marks : 100
Part - A (10 * 2 = 20)
1. What are the applications of Computer Graphics?
2. Mention the categories of flat panel displays.
3. Mention the methods for joining line segments.
4. Give the 2D transformation matrix for rotation.
5. Define clipping.
6. What are the various three dimensional methods?
7. Define perspective projection.
8. What is a spline?
9. What do you mean by color model?
10. What are complementary colors? Give example.
Part - B (5 * 16 = 80)

## 11. a) (i) Write short notes on video display devices. (8)

(ii) Write short notes input devices. (8)
(OR)
b) Explain midpoint circle generating algorithm. (16)

## 12. a)Explain midpoint ellipse generating algorithm . (16)

(OR)
b) Explain two dimensional translation and rotation in detail. (16)

## 13. a) Explain line clipping algorithm in detail. (16)

(OR)
b) Explain filled area primitives in detail. (16)
14. a)Explain polygon surface and octree encodings in detail. (16)
(OR)
b)Explain any two color models in detail. (16)

## 15. a) Write short notes on line attributes. (16)

(OR)
b) Write short notes on
(i) three dimensional display methods (4)
(ii) polygon clipping (4)
(iii) storage of color information (8)
SET –I
Part –A
1. (i) time consuming

## (ii) accumulation of roundoff error in successive floating point increment

can cause the calculated pixel position to drift away from the true line
path.

## 4. It is the process of filling an area with rectangular pattern.

5. Affine transformation:

## coordinate transformation of the form

xI = axxx + axyy + bx

yI = ayxx + ayyy + by

## 7. parallel lines in world coordinate scenes are projected as parallel lines in

2D display plane

8. Blobby objects

## 9. The term chromaticity is used to refer collectively to the two properties

describing the color characteristics namely purity and dominant frequency

Part – B

11.a

 CAD

circuits

##  Use wireframe outline form to display the objects

(2)

 Presentation graphics

##  Used to summarize financial, statistical, mathematical, scientific

and economic data for research reports, managerial and other
types of reports (2)

 Computer art

using a stylus

(2)

 Entertainment

##  Graphics methods are used in making motion pictures ,

music videos & T.V shows
(2)

systems

##  to design special systems for giving trainings

(simulators) (2)
 Visualization

 Scientific

 Business (2)

 Image processing

##  Used to modify/interpret pictures & T.V scans

 Used in robotics
(2)

 ICON (2)

b.

 Translation

## Points are translated by the same amount

Translation equation:

x I = x + tx yI = y + ty

Matrix equation:

PI = P + T
(4)

 Rotation

## To generate rotation specify

• rotational angle Θ

## • rotation point/pivot point

xI = x Cos Θ – y Sin Θ
yI = x Sin Θ + y Cos Θ

PI = R.P
(4)

 Scaling

## coordinate values of the vertex is multiplied by scaling factors Sx

& Sy

xI = x . Sx

yI = y . Sy

Uniform Scaling : Sx = Sy

Differential Scaling: Sx ≠ Sy
(4)

 Reflection

axis. (2)

 Shear

(2)

## • Declare the necessary variables

• Obtain the end points from the user
• Calculate ∆x, ∆y,2∆x,2∆y,2∆y-2∆x and obtain the decisive parameter P0 =2∆y-∆x
• At each xk along the line starting at k=0 , perform the following test
• If Pk < 0 , the next point to be plotted is (xk+1, yk ) &
Pk+1 = Pk + 2∆y
• If Pk > 0 , the next point to be plotted is (xk+1, yk +1) &
Pk+1 = Pk + 2∆y - 2∆x
• Repeat the above steps ∆x times (12)+(4)

b.
performed by processing polygon vertices against each clip rectangle boundary
Processing cases
1. First vertex is outside , Second is inside
add second vertex & intersection point of polygon edge with window
boundary to o/p vertex list (4)
2. If both vertices are inside
add the second vertex to o/p vertex list (4)
3. If the first vertex is inside ,second is outside (4)
save the edge intersection point with window boundary to o/p vertex list
4. If both vertices are outside
add nothing to o/p vertex list (4)

13.a
Every line endpoint is assigned a four digit binary code – region code
Region code identifies the location of the point relative to the boundaries of the
clipping rectangle
 Bit 1 is set to 1 if x < xwmin
 Bit 2 is set to 1 if x > xwmax
 Bit 3 is set to 1 if y < ywmin
 Bit 4 is set to 1 if y > ywmax (4)

 Accept the lines whose both endpoints are having the region code 0000
 Reject the lines whose endpoints have a 1 in the same bit position in the
region code
 Lines that cannot be identified as completely inside or outside a clip
window are checked for intersection with window boundaries
 Intersection with clipping boundary can be calculated using the slope
intercept form of the line equation. (8)
 The intersection point with the vertical boundary is
y = y1 + m (x – x1 )
(2)
 The intersection point with the horizontal boundary is
x = x1 + (y – y1) / m
(2)
b.
• Declare the necessary variables
• Obtain the center ,major and minor axes of the ellipse
• Determine the first point of the ellipse (0,ry)
• Calculate the decision parameter for the region as P10 = ry2 – rx2 ry + rx 2/4 (2)
• At each x starting from k =0 in region 1 perform the following test
 If P < 0 the next point to be plotted is (x k+1, yk )and P1 k+1 = P1 k +2ry2 x k+1 +ry2
(2)
 Else the next point to be plotted is (x ,y ) and P1 k+1 = P1 k +2ry2x k+1 – 2rx2y k+1 +ry2
(2)
 Repeat for all k until 2 ry2x >= 2rx2y (2)
• For region 2 calculate decision parameters as P2 0 = ry (x + 1/2) +rx (y0- 1) 2 - rx2ry2
2 2 2

(2)
• At each position in region 2 starting from x = 0 for each xk perform the
following test
 If P > 0 the next point to be plotted along the ellipse is (xk ,yk-1) and P2
2 2
k+1 = P2 k -2rx y k+1 + rx (2)
 Else the next point to be plotted along the ellipse is (x , y) and P2 k+1 =
P2 k + 2ry2x k+1 – 2rx2y +rx2
(2)
• Determine the symmetry points in other three quadrants
• Repeat the steps for all regions until 2ry2x >= 2rx2y
(2)

14.a
• Parallel projection
 parallel lines in world coordinate scenes are projected as parallel lines
in 2D display plane.
(3)
• Perspective projection
 parallel lines that are not parallel to the display plane are projected
into converging lines.
(3)
• Depth Cueing
 method to indicate the depth with wire frame display.
 intensity of the objects are varied according to their distance from the
viewing position
(2)
• Visible line & surface identification
 clarify depth relationships
 highlight visible lines in a different color
 non visible lines are displayed as dashed line
(2)
• Surface Rendering
 sets the surface intensity of objects according to the lighting
conditions in the scene and according to assigned surface characteristics
(2)
• Exploded & cutaway views
 show the internal structure and relationships of object parts
 cut away view removes part of visible surfaces to show internal
structure
(2)
• 3 D & Stereoscopic view
 obtained by reflecting a raster image from a vibrating flexible mirror
 stereoscopic view provides separarte views for left eye & right eye (2)
b. HSV color model
 color parameters are hue (H), saturation (S) and value(V)
 3D representation(hexcone) derived from RGB cube
 Origin black & Vertex white
 Boundary of the hexagon represents various hues
 Saturation is measured along horizontal axis, varies from 0 to 1
 Value is measured along vertical axis , varies from 0 at the apex to 1 at the
top of the hexcone
 Hue is represented as an angle varying from 0 to 360 degrees
 Complementary colors are 180 degrees apart
 Adding black decreases V while S is constant
 Adding white decreases S while V is constant
(8)
HLS color model
 Double cone representation
 Color parameters are hue, lightness and saturation
 Hue specifies angle
 Complementary colors are 180 degrees apart
 Vertical axis – lightness
 L=0 represents black and L =1 represents white
 S varies from 0 to 1
 Increasing and decreasing L makes the color lighter and darker
 Decreasing S moves the color toward gray
(8)

15.a
 Polygon & Quadric surfaces
- Object descriptions are stored as sets of surface polygons
- The surfaces are described with linear equations
Polygon table
• data is placed into the polygon table for processing
• Polygon data table can be organised into two groups
 geometric table
 attribute table (4)
 Spline surfaces
it is a composite curve formed with polynomial pieces satisfying a
specified continuity conditions at the boundary of the pieces
Control points
it is a set of point that indicate the general shape of the curve
• interpolation of control points
• approximation of control points
• convex hull
Parametric continuity conditions
Imposed at connection points to ensure smooth transitions from one
curve to another
 Zero order parametric continuity
 First order parametric continuity
 Second order parametric continuity (4)
Fractal constructions & particle systems
Characteristics of fractal objects
• Infinite detail at every point
• Self similarity between object parts
Fractal Generation Procedure
Repeated application of a specified transformation function
to points within a region of space
Classification of fractals
• Self similar fractals
• Self affine fractals
• Self squaring fractals
• Self inverse fractals
(4)
 Octree encodings
• divides 3D space into octants
• Stores 8 data elements in each node
• Individual elements of 3D space are called voxels
• If all voxels in an octant are of same type the value is stored in the corresponding data
element of the node
• Otherwise the octant is subdivided into octants & the corresponding data element in the
node points to the next node
• Each node can have 0 to 8 immediate descendants (4)
b.
(i)
Mapping a part of a world coordinate scene to device coordinates
(1)
2D viewing transformation pipeline
MC → WC → VC →NVC →DC
(1)
The mapping of a point at position P(xw , yw ) in window to viewport is given by
xv = xvmin + (xw – xwmin ).sx
(1)
yv = yvmin + (yw – ywmin ).sy
(1)
where
sx = xvmax – xvmin / xwmax – xwmin
(1)
sy = yvmax – yvmin / ywmax – ywmin
(1)
(ii)
 Identifies the interior region of objects
Types of tests
 odd – even rule
draw a line from a point to a distant point outside ,if the no. of edges crossed is odd the
point is interior otherwise the point is exterior (3)
 non zero winding number rule
initialize winding number to 0 for each edge which crosses the line from right to left add
1 and for each edge crossing from left to right subtract 1 if winding no. is non zero the point
is inside otherwise it is outside (3)
(iii)
• locate the intersection points ( scanline with the polygon edges)
• Sort the points from left to right
• Set the frame buffer position between each intersection pair with the
specified color
(2)
Polygon and sorted edge table
• Non horizontal edges are sorted into an edge table
• Each entry in the table contains
 Maximum y value for the edge
 X intercept value
 Inverse slope of the edge
(2)
Process scan line from bottom to top of the polygon

SET –II

Part-A

1.

 CAD
 Presentation graphics

 Computer art

 Entertainment

##  Education & Training

 Visualization

 Image processing

##  Graphical user interface

2.

 emissive displays

##  non emissive displays

3.

 Miter join

 Round join

 Bevel join

4. xI = x Cos Θ – y Sin Θ

yI = x Sin Θ + y Cos Θ

## PI = R.P where R = [ Cos Θ – Sin Θ ]

Sin Θ Cos Θ
5. It is the process of identifying whether portions of a picture is inside or outside a
specified region of space
6.

 Parallel projection

 Perspective projection

 Depth cueing

##  3 D & Stereoscopic views

7. parallel lines that are not parallel to the display plane are projected into converging lines.
8. It is a composite curve formed with polynomial pieces satisfying a specified continuity
conditions at the boundary of the pieces
9. It is a method for explaining the properties or behavior of color within some particular
context
10. Colors that combine together to produce white color are called complementary colors.
Ex. blue & yellow

Part-B

11.a
(i) Primary output device – video monitor

## Operation is based on std. CRT

 Beam of electrons emitted by electron gun passes through focusing & deflection system that
direct the beam towards specified position on phosphor coated screen which emits a small spot of
light
(1)

 Properties

Persistence- time taken for the emitted light to decay to one tenth of its original
intensity
Resolution - max. no. of points that can be displayed without overlap on the CRT
Aspect Ratio- ratio of vertical points to horizontal points necessary to produce equal
length lines in both directions on the screen (3)
 Raster Scan Displays

##  Frame Buffer/Refresh Buffer:

memory area that stores the picture definition(intensity values for all screen points) (1)

##  Horizontal & Vertical retrace

Return of electron beam to the left of the screen after refreshing each scanline

Return of the electron beam to the top left corner at the end of each frame to begin the next
frame (1)

##  Random Scan Display

Electron beam is directed only to parts of the screen where a picture is to be drawn

(ii)

(1)

(1)

##  TRACK BALL (ball rotated with fingers/palm)

(1)

 SPACEBALL (does not move strain gauges measure pressure applied to provide i/p) (1)

(1)

##  DATA GLOVE (to hold virtual objects) (1)

 DIGITIZERS (graphics tablet used for drawing ,stylus is used in combination) (1)

b.

## 1. Declare the necessary variables

2. Obtain the center and the radius of the circle
3. Determine the first point on the circumference
4. Calculate the decision parameters P0 = 1.2 – r ,if r is an integer then P0 = 1 – r
5. At each xk starting from k = 0 perform the following steps if x0 < y0
6. If Pk < 0 , the next point to be plotted is (xk+1 ,yk) & Pk+1 = Pk + 2x k+1 + 1
7. If Pk > 0 , the next point to be plotted is (xk+1 ,yk-1) & Pk+1 = Pk + 2x k+1 + 1 – 2y k+1
8. Determine symmetry points in the remaining 7 octets
9. Repeat steps 5 to 8 until x< y

12.a
• Declare the necessary variables
• Obtain the center ,major and minor axes of the ellipse
• Determine the first point of the ellipse (0,ry)
• Calculate the decision parameter for the region as P10 = ry2 – rx2 ry + rx 2/4
• At each x starting from k =0 in region 1 perform the following test
 If P < 0 the next point to be plotted is (x k+1, yk )and P1 k+1 = P1 k +2ry2 x k+1
+ry2
 Else the next point to be plotted is (x ,y ) and P1 k+1 = P1 k +2ry2x k+1 – 2rx2y k+1
+ry2
 Repeat for all k until 2 ry2x >= 2rx2y
• For region 2 calculate decision parameters as P2 0 = ry2 (x + 1/2) 2+rx2 (y0- 1) 2
- rx2ry2
• At each position in region 2 starting from x = 0 for each xk perform the
following test
 If P > 0 the next point to be plotted along the ellipse is (xk ,yk-1) and P2 k+1 = P2
2 2
k -2rx y k+1 + rx
 Else the next point to be plotted along the ellipse is (x , y) and P2 k+1 = P2 k +
2ry2x k+1 – 2rx2y +rx2
• Determine the symmetry points in other three quadrants
• Repeat the steps for all regions until 2ry2x >= 2rx2y
b. Translation
 Moves the object without deformation
 Points are translated by the same amount (2)
Translation equation:
xI = x + tx yI = y + ty (2)
Matrix equation:
PI = P + T (1)
Rotation
 Reposition an object along the circular path in the XY plane (2)

## To generate rotation specify

 rotational angle Θ
 rotation point/pivot point (2)
+ ve values for Θ define anticlockwise rotation
- ve values for Θ define clockwise rotation (1)
Transformation equation:
xI = r Cos( Ф+Θ) = r Cos Ф Cos Θ – r Sin Ф Sin Θ
yI = r Sin( Ф + Θ) = r Cos Ф Sin Θ + r Sin Ф Cos Θ
(2)
but
x = r Cos Ф
y = r Sin Ф
(1)
So,
xI = x Cos Θ – y Sin Θ
yI = x Sin Θ + y Cos Θ (2)
Column vector rep.
PI = R.P
(1)
13.a
Every line endpoint is assigned a four digit binary code – region code (1)
 Bit 1 – left
 Bit 2 – right
 Bit 3 – below
 Bit 4 – above (1)
 Bit 1 is set to 1 if x < xwmin
 Bit 2 is set to 1 if x > xwmax
 Bit 3 is set to 1 if y < ywmin
 Bit 4 is set to 1 if y > ywmax (2)
 Accept the lines whose both endpoints are having the region code 0000
 Reject the lines whose endpoints have a 1 in the same bit position in the region code
 Lines that cannot be identified as completely inside or outside a clip window are checked for
intersection with window boundaries
 Intersection with clipping boundary can be calculated using the slope intercept form of the
line equation.
 The intersection point with the vertical boundary is
y = y1 + m (x – x1 )
 The intersection point with the horizontal boundary is
x = x1 + (y – y1) / m (12)
b.
Scan line polygon fill approach
• locate the intersection points ( scanline with the polygon edges)
• Sort the points from left to right
• Set the frame buffer position between each intersection pair with the specified color
Polygon and sorted edge table
• Non horizontal edges are sorted into an edge table
• Each entry in the table contains
 Maximum y value for the edge
 X intercept value
 Inverse slope of the edge
Process scan line from bottom to top of the polygon (10)

Inside-Outside test
 Identifies the interior region of objects
Types of tests
 odd – even rule
 non zero winding number rule (2)
Boundary fill approach
start from interior and paint outwards towards the boundary
Methods to proceed
 4-connected
 8-connected (2)
Flood fill alg.(to fill an area with multiple colors)
Start from a point and reassign all pixel values that are set with a given color with the
desired fill color (2)
14.a
- Object descriptions are stored as sets of surface polygons
- The surfaces are described with linear equations
Polygon table
• data is placed into the polygon table for processing
• Polygon data table can be organised into two groups
 geometric table
 attribute table (2)
Storing geometric data
To store geometric data three lists are created
 Vertex table – contains coordinate values for each vertex
 Edge table – contains pointers back into the vertex table
 Polygon table – contains pointers back into the edge table
Advantages of three table
efficient display of objects
For faster info. Extraction
expand edge table to include forward pointers to the polygon table (2)
To check data consistency & completeness
Check that
 every vertex is an endpoint for atleast two edges
 Every edge is part of atleast one polygon
 Every polygon is closed
 Every polygon has atleast one shared edge
 Every edge referenced by a polygon pointer has a reciprocal pointer back to the polygon
(4)
Plane Equation
Ax + By + Cz + D = 0
eqn. is solved by Cramer’s rule
Identification of points
• if Ax + By + Cz + D < 0 ,the points (x,y,z) is inside the surface
• if Ax + By + Cz + D > 0 ,the points (x,y,z) is outside the surface (2)
Octree encodings
 Hierarchical tree structure
 Node corresponds to a region in 3D space
 Extension of quadtree encodings(2D) (2)
Octree
- divides 3D space into octants
- Stores 8 data elements in each node
- Individual elements of 3D space are called voxels
- If all voxels in an octant are of same type the value is stored in the corresponding data
element of the node
- Otherwise the octant is subdivided into octants & the corresponding data element in the
node points to the next node
- Each node can have 0 to 8 immediate descendants (4)

## b. YIQ color model

 NTSC color model
 Based on concepts of CIE XYZ model
• Y contains Luminance information
• I and Q incorporates hue and purity information
• Combination of red, green and blue intensities are chosen for Y parameter
• Black and white television monitors use only Y signal
• Largest band width assigned to Y information (6)
• NTSC encoder converts RGB signal to television signal
Y 0.299 0.587 0.144 R
I = 0.596 -0.275 -0.321 . G
Q 0.212 -0.528 0.311 B (1)

## • NTSC decoder converts NTSC video signals into RGB signal

R 1.000 0.956 0.620 Y
G = 1.000 -0.272 -0.647 . I
B 1.000 -1.108 1.705 Q (1)

## CMY color model

 Primary colors Cyan ,Magenta, Yellow
 Describes color output to hard copy devices
 Unit cube representation
 Point (1,1,1) represents black
 Printing process generates color point with a collection of four ink dots
 One dot each for the primary colors and one for black (6)
Color conversion from RGB to CMY
C 1 R
M = 1 - G
Y 1 B (1)
Color conversion from CMY TO RGB
R 1 H
G = 1 - S
B 1 V (1)

15.a
Line type - is set by the function
setLinetype(lt)
lt ranges from 1 to 4
1 – solid line
2 – dashed line
3 – dotted
4 – dash dotted
Line width - is set by the function (3)
setLinewidthScaleFactor(lw)
lw – 1 std.line width
>1 thicker line
0.5 half of std. width (3)
Pixel mask
 string contains the digits 1 and 0
 Indicates the positions to plot (3)
Line caps
 adjust the shape of the line ends
 gives the lines better appearance (1)
Types of line caps
 Butt cap
 Round cap
 Projecting square cap (3)
Methods to join line segments
 Miter join
 Round join
 Bevel join (3)
b.(i)
• Parallel projection
• Perspective projection
• Depth cueing
• Visible lines & Surface identification
• Exploded & Cutaway views
• 3 D & Stereoscopic views (4)

(ii)

##  performed by processing polygon vertices against each clip rectangle boundary

Processing cases
1. First vertex is outside , Second is inside
 add second vertex & intersection point of polygon edge with window boundary to
o/p vertex list
2. If both vertices are inside
 add the second vertex to o/p vertex list
3.If the first vertex is inside ,second is outside
 save the edge intersection point with window boundary to o/p vertex list
4. If both vertices are outside
 add nothing to o/p vertex list (4)
(iii)
 Color options – numerically coded(+ve int)
 Codes – converted into intensity level settings for electron beams
 No. of color choices – amount of storage provided per pixel
Methods to store color info. in frame buffer
 Direct storing of color codes
 Use of a separate table for color code and an index (2)

## Direct Storing of color codes

Color code is specified by the application program
Corresponding binary value is placed in the frame buffer
Minimum no. of colors can be provided
code R G B displayed color code R G B displayed color
0 0 0 0 black 4 1 0 0 Red
1 0 0 1 blue 5 1 0 1 Magenta
2 0 1 0 green 6 1 1 0 Yellow
3 0 1 1 cyan 7 1 1 1 White (3)
Color Table
 Frame buffer values are used as indices into the table
 Each entry in the table uses 24 bits to specify an RGB color
 Entries can be changed instantly
 Does not require large frame buffers
 Provides reasonable no. of colors (3)