FirstRanker Logo

FirstRanker.com - FirstRanker's Choice is a hub of Question Papers & Study Materials for B-Tech, B.E, M-Tech, MCA, M.Sc, MBBS, BDS, MBA, B.Sc, Degree, B.Sc Nursing, B-Pharmacy, D-Pharmacy, MD, Medical, Dental, Engineering students. All services of FirstRanker.com are FREE

📱

Get the MBBS Question Bank Android App

Access previous years' papers, solved question papers, notes, and more on the go!

Install From Play Store

Download Anna University B-Tech CSE 5th Sem CS6513 Computer Graphics CG Lab Manual Question Paper

Download Anna University B.Tech (Bachelor of Technology) CSE (Computer Science And Engineering) 5th Sem CS6513 Computer Graphics CG Lab Manual Question Paper.

This post was last modified on 13 December 2019

Anna University B.Tech Lab Manual


DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING

CS6513 - COMPUTER GRAPHICS LABORATORY

--- Content provided by‌ FirstRanker.com ---

V SEMESTER - R 2013

LABORATORY MANUAL

Name : ____________________________________

Register No. : ____________________________________

Section : ____________________________________

--- Content provided by‌ FirstRanker.com ---

VISION

College of Engineering is committed to provide highly disciplined, conscientious and enterprising professionals conforming to global standards through value based quality education and training.

MISSION

  • To provide competent technical manpower capable of meeting requirements of the industry
  • To contribute to the promotion of Academic Excellence in pursuit of Technical Education at different levels
  • --- Content provided by FirstRanker.com ---

  • To train the students to sell his brawn and brain to the highest bidder but to never put a price tag on heart and soul

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

VISION

To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering through quality education and to provide enthusiastic professionals with commitment

MISSION

--- Content provided by‌ FirstRanker.com ---

  • To educate the students with the state-of-art technologies to meet the growing challenges of the electronics industry
  • To carry out research through continuous interaction with research institutes and industry, on advances in communication systems
  • To provide the students with strong ground rules to facilitate them for systematic learning, innovation and ethical practices

PROGRAMME EDUCATIONAL OBJECTIVES (PEOS)

  1. Fundamentals

    To impart students with fundamental knowledge in Mathematics, Science and fundamentals of Engineering that will would them to be successful professionals

    --- Content provided by⁠ FirstRanker.com ---

  2. Core Competence

    To provide students with sound knowledge in engineering and experimental skills to identify complex software problems in industry and to develop practical solution for them

  3. Breadth

    To provide relevant training and experience to bridge the gap between theory and practice this enables to find solutions for real time problem in industry and organization and to design products requiring interdisciplinary skills

  4. --- Content provided by⁠ FirstRanker.com ---

  5. Professionalism skills

    To bestow students with adequate training and provide opportunities to work as team that will build up their communication skills, individual leadership and supportive qualities and to develop them to adapt and work in ever changing technologies

  6. Lifelong Learning

    To develop the ability of students to establish themselves as professionals in Computer Science and Engineering and to create awareness about the need for lifelong learning and pursuing advanced degrees

PROGRAMME OUTCOMES (POS)

--- Content provided by‍ FirstRanker.com ---

  1. To apply basic knowledge of Mathematics, Science and engineering fundamentals in Computer Science and Engineering field
  2. To design and conduct experiments as well as to analyze and interpret and apply the same in the career
  3. To design and develop innovative and creative software applications
  4. To understand a complex real world problems and develop an efficient practical solutions
  5. To create, select and apply appropriate technique, resources, modern engineering and IT tools
  6. --- Content provided by​ FirstRanker.com ---

  7. To understand their roles as professionals and give the best to the society
  8. To develop a system that will meet expected need with realistic constraints such as economical, environmental, social, political, ethical, safe and sustainable
  9. To communicate effectively and make others understand exactly what they are trying to convey in both verbal and written forms
  10. To engage lifelong learning and exhibit their technical skills
  11. To develop and manage projects in multidisciplinary environments
  12. --- Content provided by‍ FirstRanker.com ---

CS6513-COMPUTER GRAPHICS LABORATORY

SYLLABUS

COURSE OBJECTIVES

  • Understand graphics programming.
  • Be exposed to creation of 3D graphical scenes using open graphics library suits.
  • --- Content provided by​ FirstRanker.com ---

  • Be familiar with image manipulation, enhancement.
  • Learn to create animations.
  • To create a multimedia presentation/game/project

LIST OF EXPERIMENTS:

  1. Implementation of algorithms for drawing 2D primitives – Line (DDA, Bresenham's) – all slopes circle (midpoint).
  2. --- Content provided by‍ FirstRanker.com ---

  3. 2D geometric transformations – translation, rotation, scaling, reflection, shear, window to viewport.
  4. Composite 2D transformations.
  5. Line clipping.
  6. 3D transformations - translation, rotation, scaling.
  7. 3D projections – parallel, perspective.
  8. --- Content provided by FirstRanker.com ---

  9. Creating 3D scenes.
  10. Image editing and manipulation - basic operations on image using any image editing software.
  11. Creating gif animated images, image optimization
  12. 2D Animation - to create Interactive animation using any authoring tool

COURSE OUTCOMES

--- Content provided by FirstRanker.com ---

  • Create 3D graphical scenes using open graphics library suits.
  • Implement image manipulation and enhancement.
  • Create 2D animations using tools.

CS6513-COMPUTER GRAPHICS LABORATORY

CONTENTS

--- Content provided by FirstRanker.com ---

Sl. No. Name of the Experiment Page No.
CYCLE 1 - EXPERIMENTS
A Implementation of Algorithms for drawing 2D Primitives
1 Implementation of DDA line drawing algorithm 7
2 Implementation of Bresenham's line drawing algorithm 9
3 Implementation of Bresenham's circle drawing algorithm 11
B 2D Geometric Transformations
4 Implementation of two dimensional basic transformations – Translation, Rotation, Scaling 14
5 Implementation of two dimensional transformations – Reflection and Shear 19
6 Implementation of window – to – viewport mapping 23
7 Implementation of composite 2D transformations 26
8 Implementation of Cohen Sutherland line clipping algorithm 30
9 Implementation of Three Dimensional Transformations - Translation, Rotation, Scaling 33
10 Implementation of 3D image projections 36
11 Creation of 3D scenes 40
CYCLE 2 – EXPERIMENTS
C Image Editing and Manipulation
12. Implementation of basic operations on image using Photoshop 43
13. Creation of gif animated images 45
14 Optimizing an image 47
15 Create a 2D interactive animation using Flash 55
ADDITIONAL EXPERIMENTS BEYOND THE SYLLABUS
16 Generate a 2D image and add motion to it using C 58
17 Implementation of Bresenham's ellipse drawing algorithm 61
18 Implementation of line, circle and ellipse attributes 63
19 Implementation of Sutherland Hodgeman polygon clipping algorithm 66

Expt. No. 1

IMPLEMENTATION OF ALGORITHMS FOR DRAWING 2D PRIMITIVES

LINE DRAWING USING DDA ALGORITHM

Aim:

To write a C program to draw a line using DDA algorithm

--- Content provided by​ FirstRanker.com ---

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

Algorithm:

--- Content provided by‌ FirstRanker.com ---

  1. Start the program.
  2. Read the starting and ending coordinates xa, ya, xb, and yb,
  3. Find the x-coordinate difference and y-coordinate difference
  4. dx = xb - xa & dy = yb – ya,

  5. Compare the difference and decide the step value
  6. --- Content provided by​ FirstRanker.com ---

    if (dx > dy) step = dx

    else

    step = dy,

  7. Find the increment values of coordinates
  8. xi = dx / step

    --- Content provided by‍ FirstRanker.com ---

    yi = dy / step,

  9. Display the starting point using the function putpixel(xa,ya,4),
  10. Find adjacent pixels using the formula xa = xa + xi & ya = ya + yi,
  11. Repeat the steps till reaching the endpoints i.e., ya = yb & xa = xb,
  12. Stop the program.
  13. --- Content provided by​ FirstRanker.com ---

Sample Output:

Enter the starting coordinates: 100 100

Enter the ending coordinates: 200 200

Fig.No 1 Line using DDA

Result:

--- Content provided by‍ FirstRanker.com ---

Thus the line was drawn successfully using DDA algorithm in C.

Outcome:

Thus the outcome of implementing 2D primitives has been attained.

Application:

  • Image processing
  • --- Content provided by⁠ FirstRanker.com ---

  • Computer art
  • Presentation graphics

Viva-voce

  1. What are the advantages of DDA algorithm?
  2. Define - Computer Graphics
  3. --- Content provided by‌ FirstRanker.com ---

  4. What are the properties of video display devices?
  5. What are the various applications of computer graphics?
  6. What is resolution?
  7. What is a bitmap?
  8. List out the important characteristics of video display device.
  9. --- Content provided by‌ FirstRanker.com ---

  10. What is meant by pixel?
  11. What is intensity?
  12. Define – DDA Algorithm

Expt. No. 2

LINE DRAWING USING BRESENHAM'S ALGORITHM

--- Content provided by‌ FirstRanker.com ---

Aim:

To write a program in C to draw a line using Bresenham's algorithm

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

--- Content provided by​ FirstRanker.com ---

Dual core processor, DDR2 1GB RAM, 250 GB HDD

Algorithm:

  1. Start the program.
  2. Read the starting and ending coordinates xa, ya, xb, yb,
  3. Find the x-coordinate difference and y-difference
  4. --- Content provided by‌ FirstRanker.com ---

    dx = xb - xa & dy = yb – ya,

  5. Calculate decision parameter 'p' value
  6. p = 2dy-dx,

  7. Fix the starting and ending coordinates
  8. if(xa < xb)

    --- Content provided by‌ FirstRanker.com ---

    xstart = xa ystart = ya xend = xb

    yend = yb

    else

    xstart = xb

    ystart = yb

    --- Content provided by‌ FirstRanker.com ---

    xend = xa

    yend = ya,

  9. Display the starting point using the function putpixel(xa,ya,4),
  10. Find adjacent pixels and display it using the formula given below
  11. x =xstart & y=ystart

    --- Content provided by FirstRanker.com ---

    while(x < xend)

    x = x + 1

    if(p < 0)

  12. Repeat the step 7 till reaching the end points,
  13. Stop the program.
  14. --- Content provided by​ FirstRanker.com ---

Sample Output:

Enter the xa & ya value: 200 200

Enter the xb & yb value: 350 45

Fig.No 2 Line using Bresenham's

Result:

--- Content provided by‌ FirstRanker.com ---

Thus a line is drawn successfully using Bresenham's algorithm in C

Outcome:

Thus the outcome of implementing 2D primitives has been attained.

Application:

  • Image processing
  • --- Content provided by​ FirstRanker.com ---

  • Computer art
  • Presentation graphics

Viva-voce

  1. What is the property that reduces the pixel calculation in Bresenham's circle drawing algorithm?
  2. What is the equation used to find decision parameter in Bresenham's line drawing algorithm?
  3. --- Content provided by⁠ FirstRanker.com ---

  4. What is meant by rasterization?
  5. List out the advantages and disadvantages of DVST.
  6. What are the two techniques for producing color displays with a CRT?
  7. What is vertical retrace of the electron beam?
  8. What is meant by frame buffer?
  9. --- Content provided by‌ FirstRanker.com ---

  10. Distinguish between track ball and space ball.
  11. Define - Digitizers

Expt. No. 3

CIRCLE DRAWING USING BRESENHAM'S CIRCLE ALGORITHM

Aim:

--- Content provided by FirstRanker.com ---

To draw a circle using Bresenham's circle drawing algorithm in C

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

--- Content provided by‍ FirstRanker.com ---

Algorithm:

  1. Start the program.
  2. Get the radius and center of the circle r, xc, yc,
  3. Obtain the first point on the circumference of a circle centered on the origin as (Xo, Yo) = (0, r),
  4. Calculate the initial value of the decision parameter as p = 5/4 – r,
  5. --- Content provided by​ FirstRanker.com ---

  6. At each xk position, starting at k=0, perform the following test if(pk < 0),
  7. the next point along the circle centered on (0,0) is (xk+1, yk+1) and pk+1 = pk + 2xk+1 + 1

    Otherwise the next point along the circle is (xk+1, yk-1) and Pk+1 = pk + 2xk+1 + 1 - 2yk+1,where 2xk+1_= 2xk+2 and = -2.

  8. Determine symmetry points in other seven octants,
  9. Move each calculated pixel position (x, y) onto the circular path centered on (xc, yc) and plot the coordinat values x = x + xc & y = y + yc,
  10. --- Content provided by⁠ FirstRanker.com ---

  11. Repeat the steps 5 to 7 until x >=
  12. Stop the program.

Sample Output:

Enter the xa value: 200

Enter the ya value: 200

--- Content provided by‌ FirstRanker.com ---

Enter the radius: 50

Fig.No 3 Circle using Bresenham's

Result:

Thus the circle was drawn successfully using Bresenham's circle drawing algorithm in C.

Outcome:

--- Content provided by‌ FirstRanker.com ---

Thus the outcome of implementing 2D primitives has been attained.

Application:

  • Image processing
  • Computer art
  • Presentation graphics
  • --- Content provided by‍ FirstRanker.com ---

Viva-voce

  1. What are the two basic techniques for producing color display with a CRT?
  2. Give three difference between shadows mask and beam penetration method.
  3. Differentiate LCD from LED.
  4. Differentiate plasma panel display from thin film electroluminescent display.
  5. --- Content provided by‍ FirstRanker.com ---

  6. Define – Bresenham's Circle Algorithm

Expt. No. 4

2D GEOMETRIC TRANSFORMATIONS

BASIC 2D TRANSFORMATIONS – TRANSLATION, ROTATION, SCALING

Aim:

--- Content provided by​ FirstRanker.com ---

To write a program to perform the basic 2D transformations like translation, rotation and scaling using transformation equation in C

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

--- Content provided by‌ FirstRanker.com ---

Algorithm:

  1. Start the program.
  2. Obtain the coordinates of the line xa, ya, xb, yb,
  3. Get the translation factors tx, ty, rotation angle a & scaling factors sx, sy,
  4. Find the translated coordinates by applying the angle as
  5. --- Content provided by FirstRanker.com ---

    x' = x + tx & y'= y + ty.

  6. Get the rotation coordinates by applying the angle as
  7. x' = abs(xa - xb) cosa - abs(ya - yb) sina

    y' = abs(xa - xb) sina + abs(ya - yb) cosa,

  8. Scaling is applied as
  9. --- Content provided by⁠ FirstRanker.com ---

    x = x * SX

    y' = y * sy,

  10. Draw the transformed line with the new coordinates (x', y'),
  11. Similarly obtain the coordinates of rectangle / triangle as consecutive set of line end points and apply all the basic transformations,
  12. Stop the program.
  13. --- Content provided by FirstRanker.com ---

Sample Output:

Line

1. Translation 2. Scaling 3. Rotation 4. Exit

Enter the choice: 1

Enter the x1 value: 100

--- Content provided by⁠ FirstRanker.com ---

Enter the y1 value: 100

Enter the x2 value: 200

Enter the y2 value: 200

Enter the translation factor in x-axis: 50

Enter the translation factor in y-axis: 0

--- Content provided by‍ FirstRanker.com ---

Fig.No 4.0 Translation

1. Translation 2. Scaling 3. Rotation 4. Exit

Enter the choice: 2

Enter the x1 value: 100

Enter the y1 value: 100

--- Content provided by‍ FirstRanker.com ---

Enter the x2 value: 200

Enter the y2 value: 200

Enter the scaling factor in x-axis: 1

Enter the scaling factor in y-axis: 2

Fig.No 4.1 Scaling

--- Content provided by​ FirstRanker.com ---

1. Translation 2. Scaling 3. Rotation 4. Exit

Enter the choice: 3

Enter the x1 value: 100

Enter the y1 value: 100

Enter the x2 value: 200

--- Content provided by‍ FirstRanker.com ---

Enter the y2 value: 200

Enter the rotation angle: 45

Fig.No 4.2 Rotation

Result:

Thus the program for performing basic 2D transformations using transformation equation is successfully executed in C.

--- Content provided by⁠ FirstRanker.com ---

Outcome:

Thus the outcome of implementing 2D geometric transformation has been met.

Application:

  • Used in traditional printing
  • Drawing technologies
  • --- Content provided by​ FirstRanker.com ---

Viva-voce

  1. What are the changes accomplished by adding attributes?
  2. Which transformation produces a mirror image of an object?
  3. Which is not a basic transformation operation?
  4. What is transformation?
  5. --- Content provided by⁠ FirstRanker.com ---

  6. What is a view plane?
  7. What are the steps involved in 3D transformation pipeline?
  8. What is fixed point scaling?
  9. Distinguish between uniform scaling and differential scaling.
  10. What are the different kinds of co-ordinate representation?
  11. --- Content provided by FirstRanker.com ---

Expt. No. 5

2D TANSFORMATIONS (REFLECTION AND SHEARING)

Aim:

To write a program to perform the other 2D transformations like reflection and shearing in C

Software requirements:

--- Content provided by‍ FirstRanker.com ---

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

Algorithm:

  1. Start the program.
  2. --- Content provided by​ FirstRanker.com ---

  3. For reflection obtain the coordinates of the triangle xa, ya, xb, yb, xc, yc,
  4. Calculate the reflection as, x` = x + 2 * (320 - x) and y` = y + 2 * (240 - y),
  5. For shearing obtain the coordinates of the square xa, ya, xb, yb, xc, yc, xd, yd,
  6. Shearing points can be calculated as x` = x + shx & y` = y + shy, where shx, shy are the shearing factors,
  7. Draw the transformed objects with the new coordinates (x`, y`),
  8. --- Content provided by‍ FirstRanker.com ---

  9. Stop the program.

Sample Output:

1. Reflection 2. Shearing 3. Exit

Enter the choice: 1

Enter the xa&ya value: 200 100

--- Content provided by‍ FirstRanker.com ---

Enter the xb&yb value: 200 200

Enter the xc&yc value: 100 200

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 1

Fig.No 5.0 Reflection about x-axis

--- Content provided by‍ FirstRanker.com ---

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 2

Fig.No 5.1 Reflection about y-axis

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 3

--- Content provided by‍ FirstRanker.com ---

Fig.No 5.2 Reflection on both

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 4

1. Reflection 2. Shearing 3. Exit

Enter the choice: 2

--- Content provided by‍ FirstRanker.com ---

Enter the xa&ya value: 200 200

Enter the xb&yb value: 300 200

Enter the xc&yc value: 300 300

Enter the xd&yd value: 200 300

1. About x-axis 2. About y-axis 3. About both 4. Exit

--- Content provided by FirstRanker.com ---

Enter the choice: 1

Enter the shearing factor for x: 50

Fig.No 5.3 Shearing about x-axis

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 2

--- Content provided by‌ FirstRanker.com ---

Enter the shearing factor for y: 50

Fig.No 5.4 Shearing about y-axis

1. About x-axis 2. About y-axis 3. About both 4. Exit

Enter the choice: 3

Enter the shearing factor for x: 50

--- Content provided by‍ FirstRanker.com ---

Enter the shearing factor for y: 50

Enter the choice: 4

Fig.No 5.5 Shearing with both axis

Result:

Thus the program for performing 2D transformations reflection and shearing is successfully executed in C.

--- Content provided by⁠ FirstRanker.com ---

Outcome:

Thus the outcome of implementing 2D geometric transformation has been met.

Application:

  • Typography
  • Cartography
  • --- Content provided by⁠ FirstRanker.com ---

  • Technical drawing.

Viva-voce

  1. What is meant by reflection?
  2. Define – Shearing
  3. What are the applications for reflection?
  4. --- Content provided by⁠ FirstRanker.com ---

  5. Compare reflection from mirroring.
  6. List out the advantages of using reflection.

Expt. No. 6

- WINDOW – TO – VIEWPORT TRANSFORMATION

Aim:

--- Content provided by‌ FirstRanker.com ---

To write a C program to perform window-to-viewport transformation

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

--- Content provided by⁠ FirstRanker.com ---

Algorithm:

  1. Start the program.
  2. Input the minimum and maximum coordinates of a window,
  3. Input the minimum and maximum coordinates of a viewport,
  4. Input the coordinates of image to be displayed,
  5. --- Content provided by‍ FirstRanker.com ---

  6. Perform the scaling to transform the image to window and to viewport,
  7. Stop the program.

Sample Output:

enter window port coordinates:

(xwmin,ywmin, xwmax, ywmax): 20 20 200 200

--- Content provided by​ FirstRanker.com ---

enter view port coordinates:

(xumin,yomin, xvmax,yumax): 20 20 400 400

enter vertices for triangle:

enter(x0,y0):50 50

enter(x1,y1): 150 150

--- Content provided by⁠ FirstRanker.com ---

enter(x2,y2):50 150

view port

Fig.No 6 Window to viewport transformation

Result:

Thus the program for performing window-to-viewport transformation is successfully executed in C.

--- Content provided by​ FirstRanker.com ---

Outcome:

Thus the outcome of implementing 2D geometric transformation has been met.

Application:

  • To draw maps, sketch of areas and buildings
  • Visualization
  • --- Content provided by​ FirstRanker.com ---

VIVA - VOCE

  1. Distinguish between window port and view port.
  2. What is the need of homogeneous coordinates?
  3. List out three font editing tools.
  4. Distinguish between window port and view port.
  5. --- Content provided by​ FirstRanker.com ---

  6. Define - Clipping
  7. What is the need for homogeneous coordinates?
  8. List out two output primitives function.
  9. What is a decision parameter?
  10. List out the two software standards.
  11. --- Content provided by⁠ FirstRanker.com ---

  12. Define - Bitmap
  13. Define - Pixelmap

Expt. No. 7

COMPOSITE 2D TRANSFORMATIONS

Aim:

--- Content provided by‍ FirstRanker.com ---

To write a program to perform the composite 2D transformations like successive translation, rotation and scaling using transformation equation in C

Software requirements:

C, C++ compilers, Java, OpenGL

Hardware requirements:

Dual core processor, DDR2 1GB RAM, 250 GB HDD

--- Content provided by⁠ FirstRanker.com ---

Algorithm:

  1. Start the program.
  2. Obtain the coordinates of the line xa, ya, xb, yb,
  3. Get the translation factors tx1, ty1, tx2, ty2 rotation angles a1, a2 & scaling factors sx1, sy1, sx2, sy2,
  4. Find the translated coordinates by applying the formula as below.
  5. --- Content provided by‍ FirstRanker.com ---

    x'= x + (tx1 + tx2) & y' = y + (ty1 + ty2)

    It possesses associative property and successive translations are proved as additive.

  6. Get the rotation coordinates by applying the formula as
  7. x' = abs(xa - xb) cos(a1 + a2) - abs(ya - yb) sin(a1 + a2)

    y' = abs(xa- xb) sin(a1 + a2) + abs(ya - yb) cos(a1 + a2)

    --- Content provided by FirstRanker.com ---

    It possesses associative property and successive rotations are also proved as additive.

  8. Scaling is applied as
  9. x' = x* (sx1 * sx2)

    y' = y * (sy1 * sy2)

    It possesses associative property and successive scaling is multiplicative.

    --- Content provided by‌ FirstRanker.com ---

  10. Draw the transformed line with the new

    This download link is referred from the post: Anna University B.Tech Lab Manual

--- Content provided by‌ FirstRanker.com ---