February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA

Size: px
Start display at page:

Download "February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA"

Transcription

1 Lab Manual February COMPUTER GRAPHICS & MUTIMEDIA INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR

2 SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland Turbo C++ (Version 4.5)

3 LIST OF PROGRAMS 1. Write A Program To Draw A Pixel? 2. Write A Program To Draw A Line Using Line Function? 3. Write A Program To Draw A Line Using Dda Algorithm.? 4. Write A Program To Draw A Line Using Bresenham s Algorithm? 5. Write A Program For Bresenham s Circle Algorithm? 6. Write A Program For Mid Point Circle Algorithm? 7. Write A Program To Translate A Triangle? 8. Write A Program To Scaling A Triangle? 9. Write A Program To Show Reflection Of A Triangle? 10. Write A Program To Rotate A Triangle.?

4 Q.1 WRITE A PROGRAM TO DRAW A PIXEL? #include<conio.h> #include<iostream.h> #include<graphics.h> clrscr(); int gdriver=detect,gmode,x,y; int x,y; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cout<<"enter the value of x and y"; cin>>x>>y; putpixel(x,y,4);

5 Q.2 WRITE A PROGRAM TO DRAW A LINE USING LINE FUNCTION? #include<conio.h> #include<iostream.h> #include<graphics.h> clrscr(); int gdriver=detect,gmode,x,y; int x1,y1,x2,y2; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); setcolor(-3); cout<<"enter the value of x and y"; cin>>x1>>y1>>x2>>y2; line(x1,y1,x2,y2);

6 Q.3WRITE A PROGRAM TO DRAW A LINE USING DDA ALGORITHM. # include<conio.h> # include<stdio.h> # include<graphics.h> # include<math.h> clrscr(); int gdriver=detect,gmode; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); int xa,ya,xb,yb; printf("enter the values of coordinate"); scanf("%d%d%d%d",&xa,&ya,&xb,&yb); int dx=xb-xa,dy=yb-ya,steps; float xinc,yinc,x=xa,y=ya; if (abs(dx)>abs(dy)) steps=abs(dx); else steps=abs(dy); xinc=dx/(float)steps ; yinc=dy/(float)steps; putpixel(x,y,-1); for(int k=0;k<=steps;k++) x=x+xinc;

7 y=y+yinc; putpixel(x,y,4);

8 Q.4 WRITE A PROGRAM TO DRAW A LINE USING BRESENHAM S ALGORITHM. # include <stdio.h> # include <conio.h> # include <graphics.h> int dx,dy,x,y,p,x1,y1,x2,y2; int gd,gm; clrscr(); printf("\n\n\tenter the co-ordinates of first point : "); scanf("%d %d",&x1,&y1); printf("\n\n\tenter the co-ordinates of second point : "); scanf("%d %d",&x2,&y2); dx = (x2 - x1); dy = (y2 - y1); p = 2 * (dy) - (dx); x = x1; y = y1; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\\tc\\bgi"); putpixel(x,y,white); while(x <= x2) if(p < 0) x=x+1; y=y; p = p + 2 * (dy); else x=x+1; y=y+1; p = p + 2 * (dy - dx); putpixel(x,y,white);

9 closegraph();

10 Q.5 WRITE A PROGRAM FOR BRESENHAM S CIRCLE ALGORITHM. #include<iostream.h> #include<conio.h> #include<graphics.h> #include<math.h> int gdriver=detect,gmode; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); clrscr(); int h,k,r,x,y; cout<<"enter the coordinates of circle"; cin>>h>>k; cout<<"enter the radius"; cin>>r; int p=3-(2*r); x=0; y=r; while(x<y) putpixel(x+h,y+k,10); putpixel(-x+h,y+k,10); putpixel(-x+h,-y+k,10); putpixel(x+h,-y+k,10);

11 putpixel(y+k,x+h,10); putpixel(-y+k,x+h,10); putpixel(-y+k,-x+h,10); putpixel(y+k,-x+h,10); if(p<0) p=p+(4+x)+6; x=x+1; y=y; else p=p+(4*(x-y))+10; x=x+1; y=y-1;

12 Q.6 WRITE A PROGRAM FOR MID POINT CIRCLE ALGORITHM? #include<iostream.h> #include<conio.h> #include<graphics.h> clrscr(); int gdriver=detect,gmode,x=0,y,r,h,k,p; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cout<<"enter the values of h and k"; cin>>h>>k; cout<<"enter the radius"; cin>>r; y=r; p=(5/4-r); while(x<y) putpixel(x+h,y+k,10); putpixel(-x+h,y+k,10); putpixel(-x+h,-y+k,10); putpixel(+x+h,-y+k,10); putpixel(y+k,x+h,10); putpixel(-y+k,x+h,10); putpixel(-y+k,-x+h,10); putpixel(+y+k,-x+h,10); if(p<0) p=p+(2*x)+1;

13 x=x++; y=y; else p=p+(2*x)-(2*y)+1; x=x++; y=y--;

14 Q.7 WRITE A PROGRAM TO TRANSLATE A TRIANGLE? #include<iostream.h> #include<conio.h> #include<graphics.h> clrscr(); int gdriver=detect,gmode,x1,y1,x2,y2,x3,y3,tx,ty; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cout<<"enter the vertices\t"<<"enter the translation value"; cin>>x1>>y1>>x2>>y2>>x3>>y3; line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); cin>>tx>>ty; line(x1+tx,y1+ty,x2+tx,y2+ty); line(x2+tx,y2+ty,x3+tx,y3+ty); line(x3+tx,y3+ty,x1+tx,y1+ty);

15 Q.8 WRITE A PROGRAM TO SCALING A TRIANGLE? #include<iostream.h> #include<conio.h> #include<graphics.h> clrscr(); int gdriver=detect,gmode,x1,y1,x2,y2,x3,y3,a,b,c,d,e,f,sx,sy; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cout<<"enter the vertices of triangle"<<"enter the value of sx and sy"; cin>>x1>>y1>>x2>>y2>>x3>>y3; line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); cin>>sx>>sy; a=x1*sx; b=y1*sy; c=x2*sx; d=y2*sy; e=x3*sx; f=y3*sy; line(a,b,c,d); line(c,d,e,f); line(e,f,a,b);

16 Q 9. WRITE A PROGRAM TO SHOW REFLECTION OF A TRIANGLE? #include<iostream.h> #include<conio.h> #include<graphics.h> #include<math.h> clrscr(); int gdriver=detect,gmode,x1,y1,x2,y2,x3,y3; char a; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); cout<<"enter the co-ordinate of triangle";//<<"enter the value of sx and sy"; cin>>x1>>y1>>x2>>y2>>x3>>y3; line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); line(320,0,320,430); line(0,240,640,240); cout<<"enter the axis of reflection"; cin>>a; if(a=='x' a=='x') x1=x1; x2=x2; x3=x3; y1=y1+240; y2=y2+240; y3=y3+240; else if(a=='y' a=='y')

17 y1=y1; y1=y1; y3=y3; x1=x1+320; x2=x2+320; x3=x3+320; cout<<"triangle after reflection"; line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1);

18 Q.10 WRITE A PROGRAM TO ROTATE A TRIANGLE. #include<iostream.h> #include<conio.h> #include<graphics.h> #include<math.h> int gdriver=detect,gmode,x1,y1,x2,y2,x3,y3; int a,b,c,d,e,f,g; float p,q; initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); clrscr(); cout<<"enter the vertices"; cin>>x1>>y1>>x2>>y2>>x3>>y3; line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); cout<<"enter the rotation angle "; cin>>a; p=cos((a*3.14)/180); cout<<p<<endl; b=((x1,p)-(y1*q)); c=((x1*q)+(y1*p)); d=((x2*p)-(y2*q)); e=((y2*q)+(y2*p));

19 f=((x3*p)-(y3*p)); g=((y3*q)+(y3*p)); line(b,c,d,e); line(d,e,f,g); line(f,g,b,c);

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini INTRODUCTION TO COMPUTER GRAPHICS Computer Graphics is the pictorial representation of information using a computer program. In Computer Graphics,

More information

1. DDA Algorithm(Digital Differential Analyzer)

1. DDA Algorithm(Digital Differential Analyzer) Basic concepts in line drawing: We say these computers have vector graphics capability (the line is a vector). The process is turning on pixels for a line segment is called vector generation and algorithm

More information

//Program1. Computer Graphics C Version Programmed By: Salha Alzahrani

//Program1. Computer Graphics C Version Programmed By: Salha Alzahrani 1 //Program1 #include #include #include #include #include #include int array1[100]; int angle[100]; void initialize_graph(void) /* select a driver

More information

//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.

//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib. //2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING #include #include #include #include #include void main() int gd=detect,gm,i,x[10],y[10],a,b,c,d,n,tx,ty,sx,sy,ch;

More information

Computer design and manufacturing lab manual

Computer design and manufacturing lab manual Computer design and manufacturing lab manual 01. BRESENHAM S ALGORITHM FOR LINE DRAWING. 1. Start. 2. Declare variables x,y,x1,y1,x2,y2,p,dx,dy and also declare gdriver=detect,gmode. 3. Initialize the

More information

Computer Graphics. Lab Manual

Computer Graphics. Lab Manual Computer Graphics. Lab Manual Page 1 Computer Graphics Lab. 1. Syllabus from the university 1. Implementation of line generation using slope s method, DDA and Bresenhem s algorithms. 2. Implementation

More information

Computer Graphics Lab. Lab Manual

Computer Graphics Lab. Lab Manual Computer Graphics Lab. Lab Manual Computer Graphics Lab. 1. Syllabus from the university a) Write a program for 2D line drawing as Raster Graphics Display. b) Write a program for circle drawing as Raster

More information

IMPLEMENTATION OF DDA LINE ALGORITHM

IMPLEMENTATION OF DDA LINE ALGORITHM IMPLEMENTATION OF DDA LINE ALGORITHM DESCRIPTION: Digital Differential Analyzer (DDA) is used for linear interpolation of variables over an interval between start and end point of a line. Simplest implementation

More information

Windowing And Clipping (14 Marks)

Windowing And Clipping (14 Marks) Window: 1. A world-coordinate area selected for display is called a window. 2. It consists of a visual area containing some of the graphical user interface of the program it belongs to and is framed by

More information

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

Scan Converting Circles

Scan Converting Circles Scan Conversion Algorithms CS 460 Computer Graphics Professor Richard Eckert Circles Ellipses and Other 2-D Curves Text February 16, 2004 Scan Converting Circles Given: Center: (h,k) Radius: r Equation:

More information

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with Two Dimensional Transformations In many applications, changes in orientations, size, and shape are accomplished with geometric transformations that alter the coordinate descriptions of objects. Basic geometric

More information

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Digital Differential Analyzer Bresenhams Line Drawing Algorithm Bresenham s Line Generation The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations. Difference Between

More information

DDA ALGORITHM. To write a C program to draw a line using DDA Algorithm.

DDA ALGORITHM. To write a C program to draw a line using DDA Algorithm. DDA ALGORITHM EX NO: 1 Aim : To write a C program to draw a line using DDA Algorithm. Algorithm: Step 1: Start the program. Step 1: Step 2: Input the line endpoints and store the left endpoint in (x1,

More information

Efficient Plotting Algorithm

Efficient Plotting Algorithm Efficient Plotting Algorithm Sushant Ipte 1, Riddhi Agarwal 1, Murtuza Barodawala 1, Ravindra Gupta 1, Prof. Shiburaj Pappu 1 Computer Department, Rizvi College of Engineering, Mumbai, Maharashtra, India

More information

COMPUTER GRAPHICS AND MULTIMEDIA

COMPUTER GRAPHICS AND MULTIMEDIA LAB MANUAL COMPUTER GRAPHICS AND MULTIMEDIA ETCS 257 Maharaja Agrasen Institute of Technology, PSP area, Sector 22, Rohini, New Delhi 110085 (Affiliated to Guru Gobind Singh Indraprastha, New Delhi) 1

More information

Tutorial No. 2 - Solution (Overview of C)

Tutorial No. 2 - Solution (Overview of C) Tutorial No. 2 - Solution (Overview of C) Computer Programming and Utilization (2110003) 1. Explain the C program development life cycle using flowchart in detail. OR Explain the process of compiling and

More information

DMI College of Engineering

DMI College of Engineering DMI College of Engineering (Affiliated to Anna University, Chennai-600 025) Palanchur, Chennai-602 123. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6513 COMPUTER GRAPHICS LABORATORY V SEMESTER/ III

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

SIR C.R.R COLLEGE OF ENGINEERING, ELURU.

SIR C.R.R COLLEGE OF ENGINEERING, ELURU. SIR C.R.R COLLEGE OF ENGINEERING, ELURU. DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING GRAPHICS AND MULTIMEDIA LAB MANUAL ACADEMIC YEAR: 2016-2017 CLASS : 4/4 B.Tech CSE I SEMESTER SUBJECT : Graphics &

More information

MET71 COMPUTER AIDED DESIGN

MET71 COMPUTER AIDED DESIGN UNIT - II BRESENHAM S ALGORITHM BRESENHAM S LINE ALGORITHM Bresenham s algorithm enables the selection of optimum raster locations to represent a straight line. In this algorithm either pixels along X

More information

Lab Programs. /* LAB1_2: To study the various graphics commands in C language */ /* LAB1_1: To study the various graphics commands in C language */

Lab Programs. /* LAB1_2: To study the various graphics commands in C language */ /* LAB1_1: To study the various graphics commands in C language */ Lab Programs /* LAB1_1: To study the various graphics commands in C language */ /* drawing basic shapes */ #include #include void main() int gd=detect, gm; int poly[12]=350,450, 350,410,

More information

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by: Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees

More information

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE DRAWING PRIMITIVES: LEGACY VS. NEW Legacy: specify primitive in glbegin() glbegin(gl_points); glvertex3f(1,5,0);

More information

Scan Conversion. Lines and Circles

Scan Conversion. Lines and Circles Scan Conversion Lines and Circles (Chapter 3 in Foley & Van Dam) 2D Line Implicit representation: αx + βy + γ = 0 Explicit representation: y y = mx+ B m= x Parametric representation: x P= y P = t y P +

More information

Output Primitives Lecture: 4. Lecture 4

Output Primitives Lecture: 4. Lecture 4 Lecture 4 Circle Generating Algorithms Since the circle is a frequently used component in pictures and graphs, a procedure for generating either full circles or circular arcs is included in most graphics

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics r About the Tutorial To display a picture of any size on a computer screen is a difficult process. Computer graphics are used to simplify this process. Various algorithms and techniques are used to generate

More information

DELHI PUBLIC SCHOOL TAPI

DELHI PUBLIC SCHOOL TAPI Loops Chapter-1 There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed

More information

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge Review Cellular Automata The Game of Life 2D arrays, 3D arrays Review Array Problems Challenge example1.pde Up until now All movement and sizing of graphical objects have been accomplished by modifying

More information

Computer Graphics. Introduction: Computer Graphics

Computer Graphics. Introduction: Computer Graphics Introduction: is a field related to the generation of graphics using computers. It includes the creation, storage, and manipulation of images of objects. These objects come from diverse fields such as

More information

NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F

NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F LAB MANUAL NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F LIST OF EXPERIMENTS NUMERICAL METHODS OF COMPUTATIONAL PROGRAMMING LAB MATH-204-F S. No. NAME OF EXPERIMENTS 1. Solution of Non-linear

More information

Painter s HSR Algorithm

Painter s HSR Algorithm Painter s HSR Algorithm Render polygons farthest to nearest Similar to painter layers oil paint Viewer sees B behind A Render B then A Depth Sort Requires sorting polygons (based on depth) O(n log n) complexity

More information

C Programming Lecture V

C Programming Lecture V C Programming Lecture V Instructor Özgür ZEYDAN http://cevre.beun.edu.tr/ Modular Programming A function in C is a small sub-program that performs a particular task, and supports the concept of modular

More information

This library uses only GL functions but contains code for creating common objects and simplifying viewing.

This library uses only GL functions but contains code for creating common objects and simplifying viewing. PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject Name:

More information

Decision Making and Branching

Decision Making and Branching INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators

More information

MODULE - 4. e-pg Pathshala

MODULE - 4. e-pg Pathshala e-pg Pathshala MODULE - 4 Subject : Computer Science Paper: Computer Graphics and Visualization Module: Midpoint Circle Drawing Procedure Module No: CS/CGV/4 Quadrant 1 e-text Before going into the Midpoint

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

CS2405 Computer Graphics Lab - Manual

CS2405 Computer Graphics Lab - Manual CS2405 Computer Graphics Lab - Manual Bresenham s Line Drawing EX NO.1(A) Aim: To implement Bresenham s line drawing Algorithm for drawing lines. Functions used: Line() The function line() is used to draw

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms ! Computer Graphics 2014! 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-26! Screen Nikon D40 Sensors 3 Rasterization - The task of displaying a world modeled

More information

Mr. Giansante. C++ Programming. Graphics

Mr. Giansante. C++ Programming. Graphics C++ Programming Graphics August 2018 Setting Up Graphics With Dev C++ In order to use Graphics with Dev C++, you must follow the instructions in the booklet entitled "Setting Up Graphics With Dev C++".

More information

by modifying the glutinitwindowsize() function you can change the screen size to whatever you please.

by modifying the glutinitwindowsize() function you can change the screen size to whatever you please. Zoe Veale Lab 2 Draw2 part 1: I edited the glutinitwindowsize() function tom change the size of my screen window. int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

C++ 8. Constructors and Destructors

C++ 8. Constructors and Destructors 8. Constructors and Destructors C++ 1. When an instance of a class comes into scope, the function that executed is. a) Destructors b) Constructors c) Inline d) Friend 2. When a class object goes out of

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Lecture 5 2D Transformation

Lecture 5 2D Transformation Lecture 5 2D Transformation What is a transformation? In computer graphics an object can be transformed according to position, orientation and size. Exactly what it says - an operation that transforms

More information

I Internal Examination (Model Paper) B.Tech III Year VI semester, Computer Science & Engineering

I Internal Examination (Model Paper) B.Tech III Year VI semester, Computer Science & Engineering I Internal Examination 2017-18 (Model Paper) B.Tech III Year VI semester, Computer Science & Engineering Subject: 6CS4 Computer Graphics & Multimedia Technology Time: 1:30 Hr M.M:40 Question No. Question

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

To graph the point (r, θ), simply go out r units along the initial ray, then rotate through the angle θ. The point (1, 5π 6. ) is graphed below:

To graph the point (r, θ), simply go out r units along the initial ray, then rotate through the angle θ. The point (1, 5π 6. ) is graphed below: Polar Coordinates Any point in the plane can be described by the Cartesian coordinates (x, y), where x and y are measured along the corresponding axes. However, this is not the only way to represent points

More information

include<iostream.h> #define PI=3.14 void main( ) { float r;a; cout<< enter any radius ; cin>>r; a=pi*pow(r,2); cout<< Area= <<a }

include<iostream.h> #define PI=3.14 void main( ) { float r;a; cout<< enter any radius ; cin>>r; a=pi*pow(r,2); cout<< Area= <<a } 1. Explain Gloabal and local variable with suitable example. 2. Difference between a runtime error and a syntax error. Give one example of each. 3. Difference between formal parameters and actual parameters.

More information

Quadrilaterals in which an angle is the mean of the other angles

Quadrilaterals in which an angle is the mean of the other angles CREATIVE MATH. 12 (200), 21-28 Quadrilaterals in which an angle is the mean of the other angles Maria S. Pop, Ileana Balazs and Gheorghe Miclăuş Abstract. In this article we determine all the quadrilaterals

More information

Lecture 5. If, as shown in figure, we form a right triangle With P1 and P2 as vertices, then length of the horizontal

Lecture 5. If, as shown in figure, we form a right triangle With P1 and P2 as vertices, then length of the horizontal Distance; Circles; Equations of the form Lecture 5 y = ax + bx + c In this lecture we shall derive a formula for the distance between two points in a coordinate plane, and we shall use that formula to

More information

THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) REG.

THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) REG. THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) NAME REG. NUMBER SEMESTER YEAR : : : : THIRUMALAI ENGINEERING COLLEGE

More information

Rasterization, or What is glbegin(gl_lines) really doing?

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

QUESTION BANK SUB: COMPUTER SCIENCE(083)

QUESTION BANK SUB: COMPUTER SCIENCE(083) BHARATIYA VIDYA BHAVAN S V M PUBLIC SCHOOL, VADODARA QUESTION BANK SUB: COMPUTER SCIENCE(083) CHAPTER 6 Pointers 2 MARKS QUESTION 1. Rewrite the following codes after removing errors, if any, in the following

More information

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization. Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,

More information

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

Lab Manual on Soft Computing [CS-801]

Lab Manual on Soft Computing [CS-801] 2014 Lab Manual on Soft Computing [CS-801] Ms. ShiIpi Jain Ms. Rakhi Arora INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT, GWALIOR 01-Feb-2014 1 SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

The pictorial representation and manipulation of data by a compute. The creation, display, and storage of pictures, with a computer

The pictorial representation and manipulation of data by a compute. The creation, display, and storage of pictures, with a computer Nihar Ranjan Roy The pictorial representation and manipulation of data by a compute The creation, display, and storage of pictures, with a computer Computer graphics is a sub-field of computer science

More information

AP Calculus. Areas and Volumes. Student Handout

AP Calculus. Areas and Volumes. Student Handout AP Calculus Areas and Volumes Student Handout 016-017 EDITION Use the following link or scan the QR code to complete the evaluation for the Study Session https://www.surveymonkey.com/r/s_sss Copyright

More information

DEPARTMENT OF INFORMATION TECHNOLOGY DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR , CUDDALORE DIST.

DEPARTMENT OF INFORMATION TECHNOLOGY DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR , CUDDALORE DIST. CS1357-GRAPHICS AND MULTIMEDIA LABORATORY LABORATORY MANUAL FOR VII SEMESTER B.TECH / IT ACADEMIC YEAR: 2013 2014 (ODD) (FOR PRIVATE CIRCULATION ONLY) ANNA UNIVERSITY, CHENNAI. DEPARTMENT OF INFORMATION

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading.

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Group A Assignment No A1. Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Aim: To draw line using DDA and Bresenham s algorithm

More information

FIVE YEARS OLD. P r o f e s s o r ikobbins B. Stoeckei ol is s h o w n b y the J u n e 1 pig c r o p

FIVE YEARS OLD. P r o f e s s o r ikobbins B. Stoeckei ol is s h o w n b y the J u n e 1 pig c r o p / K j Y- Y -K Y X Y K K Y Y 5 9-7 j < - 8 X Y Z Q X 9 K Y - K Y X K Y Z Y - x - - - - x - - - - 5 -j - - x K K j 9 x - - q z K K - - K & -«x x - q j? x z Q - 8 - x q - - 5 - K K Q Y - - x \ - x j Y 5 x

More information

WT I (SET-I) Date: Class XI Sec. Time: 1 Hr. 10 min. Computer Science M.M.: 30

WT I (SET-I) Date: Class XI Sec. Time: 1 Hr. 10 min. Computer Science M.M.: 30 WT I (SET-I) Date: Class XI Sec. Time: 1 Hr. 10 min. Computer Science M.M.: 30 Name Roll No. Instructions: a) All questions are compulsory. b) There are 15 questions in this paper and each question carries

More information

Introduction to Computer Graphics

Introduction to Computer Graphics Introduction to Computer Graphics Introduction to Computer Graphics The computer is an information processing machine. It is a tool for storing, manipulating and correcting data. There are many ways to

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics r About the Tutorial To display a picture of any size on a computer screen is a difficult process. Computer graphics are used to simplify this process. Various algorithms and techniques are used to generate

More information

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm Drawing Circles In today s lecture we ll have a look at: Circle drawing algorithms A simple technique The mid-point circle algorithm Polygon fill algorithms Summary raster drawing algorithms A Simple Circle

More information

CSCE 110 Dr. Amr Goneid Exercise Sheet (6): Exercises on Structs and Dynamic Lists

CSCE 110 Dr. Amr Goneid Exercise Sheet (6): Exercises on Structs and Dynamic Lists CSCE 110 Dr. Amr Goneid Exercise Sheet (6): Exercises on Structs and Dynamic Lists Exercises on Structs (Solutions) (a) Define a struct data type location with integer members row, column Define another

More information

INTRODUCTION TO PROGRAMMING

INTRODUCTION TO PROGRAMMING LAB MANUAL OF INTRODUCTION TO PROGRAMMING ETCS-154 Maharaja Agrasen Institute of Technology, PSP area, Sector 22, Rohini, New Delhi 110085 (Affiliated to Guru Gobind Singh Indraprastha University, New

More information

This course has three parts. Elements of C programming. Arithmatic and Error analysis. Some algorithms and their implementation

This course has three parts. Elements of C programming. Arithmatic and Error analysis. Some algorithms and their implementation This course has three parts Elements of C programming. Arithmatic and Error analysis. Some algorithms and their implementation 2 There are three steps involved in converting your idea of what is to be

More information

Bresenham s Line Algorithm in Hardware

Bresenham s Line Algorithm in Hardware Bresenham s Line Algorithm in Hardware Stephen A. Edwards Columbia University Spring 22 Bresenham s Line Algorithm Objective:Draw a line... Bresenham s Line Algorithm...with well-approximating pixels...

More information

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk Computer Graphics Lecture 2 Doç. Dr. Mehmet Gokturk Mathematical Foundations l Hearn and Baker (A1 A4) appendix gives good review l Some of the mathematical tools l Trigonometry l Vector spaces l Points,

More information

Co-ordinate Geometry

Co-ordinate Geometry Co-ordinate Geometry 1. Find the value of P for which the points (1, -), (2, -6) and (p, -1) are collinear 2. If the point P (x, y) is equidistant from the points A (1,) and B(4, 1). Prove that 2x+y =

More information

LAB MANUAL. ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES

LAB MANUAL. ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES LAB MANUAL ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES 1 Check list for Lab Manual S. No. Particulars Page Number 1 Mission and Vision 3 2 Guidelines for the student 4 3 List of Programs

More information

VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS

VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS 1. Write C++ programs to interchange the values of two variables. a. Using with third variable int n1, n2, temp; cout

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1 NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.

More information

Advantages: Disadvantages: Q.1 Explain raster scan display with its advantages and disadvantages?

Advantages: Disadvantages: Q.1 Explain raster scan display with its advantages and disadvantages? Max Marks: 10 Subject: Computer Graphics & Multimedia (7 th Semester IT 2017-18) Time: 1hr Q.1 Explain raster scan display with its advantages and disadvantages? Ans: In a raster scan system, the electron

More information

Laboratory Manual CAD/CAM LAB. B. Tech. Mechanical Engineering. for. Department of Mechanical Engineering

Laboratory Manual CAD/CAM LAB. B. Tech. Mechanical Engineering. for. Department of Mechanical Engineering Laboratory Manual CAD/CAM LAB for B. Tech. Mechanical Engineering Department of Mechanical Engineering Brij Bhooshan Education Web Portal Web: www.brijrbedu.org LABORATORY MANUAL CAD/CAM LAB for B. Tech.

More information

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring Programming and Data Structures Mid-Semester - s to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring 2015-16 February 15, 2016 1. Tick the correct options. (a) Consider the following

More information

LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM

LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM Ex.no :1 Date: LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM AIM: To write a program to implement Bresenham s algorithms for line, circle and ellipse drawing. ALGORITHM: Step1: Create a function

More information

Part 3: 2D Transformation

Part 3: 2D Transformation Part 3: 2D Transformation 1. What do you understand by geometric transformation? Also define the following operation performed by ita. Translation. b. Rotation. c. Scaling. d. Reflection. 2. Explain two

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 2rd Semester: 3rd CBNST Lab-PCS-302 LAB MANUAL Prepared By: HOD (CSE) DEV BHOOMI INSTITUTE OF TECHNOLOGY Department

More information

First of all, we need to know what it means for a parameterize curve to be differentiable. FACT:

First of all, we need to know what it means for a parameterize curve to be differentiable. FACT: CALCULUS WITH PARAMETERIZED CURVES In calculus I we learned how to differentiate and integrate functions. In the chapter covering the applications of the integral, we learned how to find the length of

More information

BRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet

BRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet BRAIN INTERNATIONAL SCHOOL Term-I Class XI 2018-19 Sub: Computer Science Revision Worksheet Chapter-1. Computer Overview 1. Which electronic device invention brought revolution in earlier computers? 2.

More information

CSE202-Lec#4. CSE202 C++ Programming

CSE202-Lec#4. CSE202 C++ Programming CSE202-Lec#4 Functions and input/output streams @LPU CSE202 C++ Programming Outline Creating User Defined Functions Functions With Default Arguments Inline Functions @LPU CSE202 C++ Programming What is

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

COORDINATE GEOMETRY CHANGE OF AXES EXERCISE 1. The point to which the origin should be shifted in order to eliminate x and y terms in the equation 4x 9y 8x 36y 4 0 is (1, ) ( 4, ( 1,) 4) (1, ). In order

More information

Area and Volume. where x right and x left are written in terms of y.

Area and Volume. where x right and x left are written in terms of y. Area and Volume Area between two curves Sketch the region and determine the points of intersection. Draw a small strip either as dx or dy slicing. Use the following templates to set up a definite integral:

More information

Raster Scan Displays. Framebuffer (Black and White)

Raster Scan Displays. Framebuffer (Black and White) Raster Scan Displays Beam of electrons deflected onto a phosphor coated screen Phosphors emit light when excited by the electrons Phosphor brightness decays -- need to refresh the display Phosphors make

More information

Pointers. Mr. Ovass Shafi (Assistant Professor) Department of Computer Applications

Pointers. Mr. Ovass Shafi (Assistant Professor) Department of Computer Applications Pointers Introduction: A variable is a named memory location that holds some value. Each variable has some address associated with it. Till now we only worked on the values stored in the variables and

More information

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal MA 511: Computer Programming Lecture 2: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Largest

More information