LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM

Size: px
Start display at page:

Download "LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM"

Transcription

1 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 for line circle and ellipse. Step2: calculate contents Ax, Ay, 2Ay, 2Ay-2Ax and P0=2Ay-Ax to draw the line. Step3: Calculate the initial value parameter as q=q+(4*m)+10,q=q+(4*(m-n))+10 and draw circle using cplot(x,y,m,n). Step4: Calculate putpixel(xc+rx*cos(i*3.14/180),yc+ry*sin(i*3.14/180),15) to draw the ellipse drawing Step5: Display line, circle and ellipse drawing of Bresenham s algorithm. 1

2 PROGRAM: #include<stdio.h> #include<conio.h> #include<math.h> #include<graphics.h> void lined(int, int, int, int); void circled(int, int, int); void ellipsed(int, int, int, int); void main( ) int x, y, xe, ye, r, rx, ry, n; int gd=detect, gm; initgraph(&gd, &gm, "e:\\tc\\bgi"); do clrscr( ); printf("\n1. Line\n2. Circle\n3. Ellipse\n"); printf("enter the Choice:"); scanf("%d",&n); switch(n) case 1: printf("\nline DRAWING\nEnter the x and y axis:"); scanf("\n%d%d",&x,&y); printf("\nenter the Xend and yend:"); 2

3 scanf("%d%d",&xe,&ye); lined(x,y,xe,ye); break; case 2: printf("\ncircle DRAWING ); printf( \nenter the x and y axis and also Radius:"); scanf("%d%d%d",&x,&y,&r); circled(x,y,r); break; case 3: printf("\nellipse DRAWING ) printf( \nenter the x,y and rx,ry:"); scanf("%d%d%d%d",&x,&y,&rx,&ry); ellipsed(x,y,rx,ry); break; default: exit(0); break; while(n<=3); getch(); closegraph( ); void lined(int xa,int ya,int xb,int yb) 3

4 int dx=abs(xa-xb); int dy=abs(ya-yb); int p=2*dy-dx; int xend=2*dy; int yend=2*(dy-dx); int x,y,end; if(xa>xb) x=xb; y=yb; xend=xa; else x=xa; y=ya; yend=xb; while(x<xend) x++; if(p<0) p+=xend; else y++; p+=yend; putpixel(x,y,10); 4

5 getch( ); void circled(int x,int y,int r) int m=0,n=r, q; void cplot(int,int,int,int); q=3-(2*r); while(m<n) cplot(x,y,m,n); if(q<0) q=q+(4*m)+10; else q=q+(4*(m-n))+10; n--; m++; if(m==n) cplot(x,y,m,n); getch( ); void cplot(int xc,int yc,int x,int y) putpixel(xc+x,yc+y,15); putpixel(xc-x,yc+y,15); 5

6 putpixel(xc+x,yc-y,15); putpixel(xc-x,yc-y,15); putpixel(xc+y,yc+x,15); putpixel(xc-y,yc+x,15); putpixel(xc+y,yc-x,15); putpixel(xc-y,yc-x,15); void ellipsed(int xc,int yc,int rx,int ry) int i; for(i=0;i<=360;i++) putpixel(xc+rx*cos(i*3.14/180),yc+ry*sin(i*3.14/180),15); getch( ); 6

7 OUTPUT:- 1.Line 2. Circle 3. Ellipse Enter the Choice:1 LINE DRAWING Enter the x and y axis:10 15 Enter the Xend and yend: Line 2. Circle 3. Ellipse Enter the Choice:2 CIRCLE DRAWING Enter the x and y axis and also Radius: Line 2. Circle 7

8 3. Ellipse Enter the Choice:3 ELLIPSE DRAWING Enter the x,y and rx,ry: RESULT: Thus the program implementation of Bresenham s algorithm for line, circle and ellipse drawing is done successfully. 8

9 Ex.no :2 Date: 2D-TRANSFORMATION AIM: To create a program to implement the 2D transformation of translation, Rotation, Scaling, Reflection and Shearing. ALGORITHM: Step 1: Start the Program. Step 2: Include the graphics header file Step 3: Initialize graphics using initgraph(). Step 4: Initialize the variable Step 5: Enter the choice for transformation. Step 6: If choice=1 Translation i.e. changing the co-ordinates is performed, x =x+tx y =y+ty Step 7: If choice=2 Rotation i.e. Rotate the object is performed x =x*cosθ-y*sinθ y =x*sinθ+y*cosθ Step 8: If choice=3 Scaling i.e.changing the size of the object is performed x =x*sx y =y*sy Step 9:If choice=4 Reflection i.e to produce the mirror image of the objects. Step 10: If choice=5 Shearing i.e Slanting the objects Step 11: Stop the Program. 9

10 PROGRAM: #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<alloc.h> #include<stdlib.h> int n,i,p[20],q[20]; int convertx(int x); int converty(int y); void axis(void); void init(void); void share(void); void translate(void); void scaling(void); void rotate(void); void reflect(void); void main( ) int ch, gd=detect,gm; initgraph(&gd,&gm,"e:\\tc\\bgi"); axis( ); printf("\b"); cleardevice( ); printf("enter THE NUMBER OF VERTICES:"); scanf("%d",&n); 10

11 printf("enterthecoordinate(reenterthefirstvertexattheend )"); for(i=0;i<2*n+2;i++) scanf("%d",&p[i]); clrscr( ); init( ); getch( ); do clrscr( ); cleardevice( ); printf("\n\t\t2d-transformations\n1.translation\n 2. ROTATION\n 3.SCALING\n4.REFLECTION\n5.SHARING\n"); printf("\n\n ENTER UR CHOICE:\n"); scanf("%d",&ch); clrscr( ); cleardevice( ); switch(ch) case 1:axis( ); init( ); translate( ); break; case 2:axis( ); init( ); rotate( ); break; case 3:axis( ); 11

12 init( ); scaling( ); break; case 4:reflect( ); break; case 5:share( ); break; while(ch!=6); closegraph( ); void axis(void) cleardevice( ); setlinestyle(solid_line,1,1); line(320,0,320,getmaxy( )); line(0,240,getmaxx( ),240); outtextxy(325,245,"0"); line(316,40,324,40); outtextxy(325,41,"400"); line(316,440,324,440); outtextxy(325,441,"-400"); line(20,236,20,244); outtextxy(19,250,"-600"); line(620,236,620,244); outtextxy(608,250,"600"); 12

13 void init( ) cleardevice( ); axis( ); setcolor(yellow); setlinestyle(solid_line,1,1); for(i=0;i<2*n+2;i+=2) q[i]=convertx(p[i]); for(i=1;i<2*n+2;i+=2) q[i]=converty(p[i]); drawpoly(n+1,q); setcolor(white); int convertx(int x) x=x/2; return(x+=320); int converty(int y) y=y/2; return(y=240-y); void share( ) int sh[20],shr[20]; float shx,shy,c; printf("(1)share RELATIVE TO X-AXIS \n"); 13

14 printf("(2)share RELATIVE TO Y-AXIS \n"); printf("\n ENTER UR CHOICE:"); scanf("%f",&c); if(c==1) init( ); printf("\n ENTER THE SHARE FACTOR(shx):"); scanf("%f",&shx); for(i=0;i<2*n+2;i+=2) sh[i]=p[i]+(shx*(p[i+1])); for(i=1;i<2*n+2;i+=2) sh[i]=p[i]; else init( ); printf("\n ENTER THE SHARE FACTOR(shy):"); scanf("%f",&shy); for(i=1;i<2*n+2;i+=2) sh[i]=(shy*p[i-1])+p[i]; for(i=0;i<2*n+2;i+=2) sh[i]=p[i]; setlinestyle(dotted_line,1,1); for(i=0;i<2*n+2;i+=2) shr[i]=convertx(sh[i]); for(i=1;i<2*n+2;i+=2) 14

15 shr[i]=converty(sh[i]); drawpoly(n+1,shr); getch( ); void translate( ) int tr[20],tr1[20],tx,ty; printf("\n ENTER THR X-TRANSLATION VECTOR:"); scanf("%d",&tx); printf("\n ENTER THR Y-TRANSLATION VECTOR:"); scanf("%d",&ty); for(i=0;i<2*n+2;i+=2) tr[i]=p[i]+tx; for(i=1;i<2*n+2;i+=2) tr[i]=p[i]+ty; setlinestyle(dotted_line,1,1); for(i=0;i<2*n+2;i+=2) tr1[i]=convertx(tr[i]); for(i=1;i<2*n+2;i+=2) tr1[i]=converty(tr[i]); drawpoly(n+1,tr1); getch( ); void scaling( ) int sc[20],sc1[20]; float sx,sy; 15

16 printf("\n ENTER THE X-AXIS SCALING FACTOR:"); scanf("%f",&sx); printf("\n ENTER THE Y-AXIS SCALING FACTOR:"); scanf("%f",&sy); for(i=0;i<2*n+2;i+=2) sc[i]=p[i]*sx; for(i=1;i<2*n+2;i+=2) sc[i]=p[i]*sy; setlinestyle(dotted_line,1,1); for(i=0;i<2*n+2;i+=2) sc1[i]=convertx(sc[i]); for(i=1;i<2*n+2;i+=2) sc1[i]=converty(sc[i]); drawpoly(n+1,sc1); getch( ); void rotate( ) int ro[20],rot[20],xr,yr,v; float ang; printf("\n ENTER THE ANGLE TO ROTATE:"); scanf("%f",&ang); ang=((ang*3.14)/180)*(-1); printf("\n ENTER THE ROTATION VERTEX ("); for(i=1;i<=n;i++) printf("%d)",i); 16

17 scanf("%d",&v); xr=p[(2*v)-2]; yr=p[((2*v)-2)+1]; for(i=0;i<(2*n+1);i+=2) ro[i]=xr+(p[i]-xr)*cos(ang)-(p[i+1]-yr)*sin(ang); ro[i+1]=yr+(p[i]-xr)*sin(ang)+(p[i+1]-yr)*cos(ang); setlinestyle(dotted_line,1,1); for(i=0;i<2*n+2;i+=2) rot[i]=convertx(ro[i]); for(i=1;i<2*n+2;i+=2) rot[i]=converty(ro[i]); drawpoly(n+1,rot); getch( ); void reflect( ) int j,c,rt[20],rft[20]; printf("\n1.x-axis REFLECTION\n2.y-AXIS REFLECTION"); printf("\n ENTER THE CHOICE:"); scanf("%d",&c); clrscr( ); cleardevice( ); if(c==1) for(i=1;i<2*n+2;i+=2) rt[i]=p[i]*(-1); 17

18 for(i=0;i<2*n+2;i+=2) rt[i]=p[i]; else for(i=0;i<2*n+2;i+=2) rt[i]=p[i]*(-1); for(i=1;i<2*n+2;i+=2) rt[i]=p[i]; init( ); setlinestyle(dotted_line,1,1); for(i=0;i<2*n+2;i+=2) rft[i]=convertx(rt[i]); for(i=1;i<2*n+2;i+=2) rft[i]=converty(rt[i]); drawpoly(n+1,rft); getch( ); OUTPUT: ENTER THE NUNBER OF VERTICES: 1 ENTER THE COORDINATE (reenter the first vertex at the end) :

19 2D-TRANSFORMATIONS 1)TRANSLATION 2)ROTATION 3)SCALING 4)REFLECTION 5)SHEARING ENTER YOUR CHOICE: 1 ENTER THE X-TRANSLATION VECTOR:80 ENTER THE Y-TRANSLATION VECTOR:50 ENTER YOUR CHOICE: 2 ENTER THE ANGLE TO ROTATE:90 ENTER THE ROTATION VERTEX (1) 1 19

20 ENTER YOUR CHOICE: 3 ENTER THE X-AXIS SCALING FACTOR:100 ENTER THE Y-AXIS SCALING FACTOR:100 ENTER YOUR CHOICE: 4 1. X-AXIS REFLECTION 2. Y-AXIS REFLECTION ENTER YOUR CHOICE:1 20

21 ENTER YOUR CHOICE: 5 1.SHEAR RELATIVE TO X-AXIS 2.SHEAR RELATIVE TO Y-AXIS ENTER YOUR CHOICE:2 ENTER THE SHEAR FACTOR (shy):100 RESULT: Ex.no :3 Date: ations is executed successfully. 3D Transformation Thu s the above program for Two Dimension al Transform 21

22 AIM: To create a program to implement the 3D transformation of translation, Rotation, Scaling of objects.. ALGORITHM: Step 1: Start the program. Step 2: Declare the necessary variables, with member functions. Step 3: Create the main function, in that function to initialize graph using do-while statement. Step 4: Using Switch statement for translation, scaling and rotation exit. Step 5: Using get function for getting the values. Step 6: Similarly, get the draw function for draw the lines. Step 7: Stop the program. 22

23 PROGRAM: #include<graphics.h> #include<process.h> #include<stdlib.h> #include<stdio.h> #include<conio.h> #include<math.h> #include<dos.h> #define X 250 #define Y 100 #define Z 100 int ori[24]; void wtor(int pts3[24]); void cube(int pts1[16]); void main( ) int gd=detect,gm,s,ch; void tran( ); void rot( ); void scale( ); initgraph(&gd,&gm,"e:\\tc\\bgi"); printf("\n\t\t 3D-TRANSFORMATION"); printf("\n\t\t~~~~~~~~~~~~~~~~~~~~\n"); printf("\n ENTER THE SIDE OF THE CUBE:"); scanf("%d",&s); 23

24 ori[0]=x; ori[1]=y; ori[2]=z; ori[3]=x+s; ori[4]=y; ori[5]=z; ori[6]=x+s; ori[7]=y; ori[8]=z+s; ori[9]=x; ori[10]=y; ori[11]=z+s; ori[12]=x; ori[13]=y-s; ori[14]=z; ori[15]=x+s; ori[16]=y-s; ori[17]=z; ori[18]=x+s; ori[19]=y-s; ori[20]=z+s; ori[21]=x; ori[22]=y-s; ori[23]=z+s; wtor(ori); getch( ); do clearviewport( ); gotoxy(35,5); printf("\n\t\t 3D-TRANSFORMATIONS \n"); printf("\n\t\t 1.TRANSLATION \n"); printf("\n\t\t 2.ROTATION \n"); printf("\n\t\t 3.SCALING\n"); printf("\n\t\t 4.EXIT\n"); printf("\n\n ENTER UR CHOICE:\n"); scanf("%d",&ch); switch(ch) case 1: wtor(ori); 24

25 tran( ); getch( ); break; case 2: wtor(ori); rot( ); getch( ); break; case 3: wtor(ori); scale( ); getch( ); break; case 4: break; default: printf("\n INVALID ENTRY!!!!!"); getch( ); break; while(ch!=4); closegraph( ); void cube(int pts1[16]) 25

26 setcolor(15); setlinestyle(dotted_line,1,1); line(pts1[0],pts1[1],pts1[2],pts1[3]); delay(200); line(pts1[2],pts1[3],pts1[4],pts1[5]); delay(200); line(pts1[2],pts1[3],pts1[10],pts1[11]); delay(200); setlinestyle(solid_line,1,1); line(pts1[4],pts1[5],pts1[6],pts1[7]); delay(200); line(pts1[6],pts1[7],pts1[0],pts1[1]); delay(200); line(pts1[0],pts1[1],pts1[8],pts1[9]); delay(200); line(pts1[4],pts1[5],pts1[12],pts1[13]); delay(200); line(pts1[6],pts1[7],pts1[14],pts1[15]); delay(200); line(pts1[8],pts1[9],pts1[10],pts1[11]); delay(200); line(pts1[10],pts1[11],pts1[12],pts1[13]); delay(200); line(pts1[12],pts1[13],pts1[14],pts1[15]); 26

27 delay(200); line(pts1[8],pts1[9],pts1[14],pts1[15]); delay(200); setcolor(15); void wtor(int pts3[24]) int pts2[16],i,j; float a1=3.14*60/180; float a2=3.14*60/180; for(i=0,j=0;i<24,j<16;i+=3,j+=2) pts2[j]=pts3[i]+pts3[i+2]*1/tan(a1)*cos(a2); pts2[j+1]=pts3[i+1]+pts3[i+2]*1/tan(a1)*sin(a2); cube(pts2); void tran( ) int tr3[24]; int i,tx,ty,tz; printf("\n ENTER THE TRANSLATION VECTORS:"); scanf("%d%d%d",&tx,&ty,&tz); for(i=0;i<24;i+=3) 27

28 tr3[i]=ori[i]+tx; tr3[i+1]=ori[i+1]+ty; tr3[i+2]=ori[i+2]+tz; wtor(tr3); void rot( ) int r3[24]; float deg,rad; int i,axis; printf("\n ENTER THE ANGLE:"); scanf("%f",&deg); rad=3.14*deg/180; printf("\n ENTER THE AXIS OF ROTATION:"); printf("x=1/y=2/z=3):\n"); scanf("%d",&axis); for(i=0;i<24;i+=3) switch(axis) case 1: r3[i]=ori[i]; r3[i+1]=ori[i+1]*cos(rad)-ori[i+2]*sin(rad); r3[i+2]=ori[i+1]*sin(rad)+ori[i+2]*cos(rad); 28

29 break; case 2: r3[i]=ori[i+2]*sin(rad)+ori[i]*cos(rad); r3[i+3]=ori[i+1]; r3[i+2]=ori[i+2]*cos(rad)-ori[i+2]*sin(rad); break; case 3: r3[i]=ori[i]*cos(rad)-ori[i+1]*sin(rad); r3[i+1]=ori[i]*sin(rad)+ori[i+1]*cos(rad); break; default: printf("\n INVALID CHOICE!!!!"); getch( ); break; wtor(r3); void scale( ) float sx,sy,sz; int i,s3[24]; printf("\n ENTER THE SCALING FACTOR:"); scanf("%f%f%f",&sx,&sy,&sz); for(i=0;i<24;i+=3) 29

30 s3[i]=ori[i]*sx; s3[i+1]=ori[i+1]*sy; s3[i+2]=ori[i+2]*sz; wtor(s3); OUTPUT: ENTER THE SIDE OF THE CUBE:50 1. TRANSLATION 2. ROTATION 3. SCALING 4. EXIT ENTER THE CHOICE: 1 ENTER THE TRANSLATION VECTORS:

31 31

32 1. TRANSLATION 2. ROTATION 3. SCALING 4. EXIT ENTER THE CHOICE: 2 ENTER THE ANGLE:45 ENTER THE AXIS OF ROTATION:(X=1/Y=2/Z=3):1 ENTER THE CHOICE: 3 ENTER THE SCALING FACTOR: RESULT: Thus the above program for Three Dimensional Transformation of Translation, Scaling and Rotation is executed successfully. 32

33 Ex.no :4 Date: Cohen Sutherland 2D clipping and windowing AIM: To write a program to implement Cohen-Sutherland 2D clipping and windowing.. ALGORITHM: Step1: Create a function to get the line co-ordinates and window co-ordinate values. Step2: Check all the co-ordinates of the lines are within the window co-ordinate or not. Step3: Clip the lines which are all outside of the window co-ordinates. Step4: After the clipping draw all the lines along with the window. 33

34 PROGRAM: #include<graphics.h> #include<stdio.h> #include<conio.h> #include<stdlib.h> #define top 200 #define left 200 #define right 400 #define bottom 400 typedef struct float x,y; wcpt2; int accept(int c1[4],int c2[4]) int k,t; t=1; for(k=0;k<=3;k++) if(c1[k] c2[k]) t=0; return(t); int ptinside(int c[4]) int p; 34

35 if(c[0] c[2] c[3]) p=0; else p=1; return(p); void main( ) wcpt2 p1,p2,tmp; int code1[4],code2[4],t[4],done=0,draw=0,i,j,k,p,y; int gd=detect,gm; float m; initgraph(&gd,&gm,"e:\\tc\\bgi"); rectangle(left,top,right,bottom); printf("2d-clipping USINGF COHEN SUTHERLAND ALGORITHM \n"); printf("**************************************************\n\n"); printf("enter THE VERTICES OF THE LINE TO BE CLIPPED \n"); scanf("%f%f%f%f",&p1.x,&p1.y,&p2.x,&p2.y); settextstyle(1,0,2); getch(); clrscr( ); cleardevice( ); outtextxy(60,100,"before CLIPPING"); rectangle(left,top,right,bottom); line(p1.x,p1.y,p2.x,p2.y); 35

36 getch( ); clearviewport( ); rectangle(left,top,right,bottom); while(!done) if(p1.x<left) code1[0]=1; else code1[0]=0; if(p1.x>right) code1[1]=1; else code1[1]=0; if(p1.y>bottom) code1[2]=1; else code1[2]=0; if(p1.y<top) code1[3]=1; else code1[3]=0; if(p2.x<left) code2[0]=1; else code2[0]=0; 36

37 if(p2.x>right) code2[1]=1; else code2[1]=0; if(p2.y>bottom) code2[2]=1; else code2[2]=0; if(p2.y<top) code2[3]=1; else code2[3]=0; if(accept(code1,code2)) done=1; draw=1; else y=0; for(k=0;k<=3;k++) if(code1[k]&&code2[k]) y=1; if(y==1) done=1; 37

38 else if(ptinside(code1)) tmp=p1; p1=p2; p2=tmp; for(i=0;i<3;i++) t[i]=code1[i]; for(i=0;i<=3;i++) code2[i]=t[i]; m=(p2.y-p1.y)/(p2.x-p1.x); if(code1[0]) p1.y=p1.y+(left-p1.x)*m; p1.x=left; else if(code1[1]) p1.y=p1.y+(right-p1.x)*m; p1.x=right; else 38

39 if(code1[2]) p1.y=p1.y+(bottom-p1.y)/m; p1.x=bottom; else if(code1[3]) p1.x=p1.x+(top-p1.y)/m; p1.y=top; if(draw) settextstyle(1,0,2); outtextxy(20,60,"after CLIPPING"); line(abs(p1.x),abs(p1.y),abs(p2.x),abs(p2.y)); getch( ); closegraph( ); 39

40 40

41 OUTPUT: 2D-CLIPPING USING COHEN SUTHERLAND ALGORITHM ************************************************** ENTER THE VERTICES OF THE LINE TO BE CLIPPED: BEFORE CLIPPING: AFTER CLIPPING: RESULT: 41

42 Thus the above program for Cohen Sutherland 2D clipping and windowing is executed successfully. 5. IMPLEMENTATION OF TWO DIMENSIONAL COMPOSITE TRANSFORMATIONS DESCRIPTION: A transformation is any operation on a point in space (x, y) that maps the point's coordinates into a new set of coordinates (x1, y1).the Two Dimensional Composite transformation represent a sequence of transformations as a single matrix which has the order of operations as Translation, Rotation, Scaling, Shearing, Reflection. CODING: #include <graphics.h> /* include the necessary header files*/ #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <math.h> int xa,xb,xc,ya,yb,yc,y1a,y1b,y1c,x1a,x1b,x1c,x2a,x2b,x2c,y2a,y2b,y2c; int x3a,x3b,x3c,y3a,y3b,y3c,x4a,x4b,x4c,y4a,y4b,y4c,x5a,x5b,x5c,y5a,y5b,y5c; int tx,shx,t,ch,shy; float ang,theta,sx,sy; int main(void) int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode,"c:\\tc\\bgi"); /* request for auto detection*/ printf("\n\t\t\t 2D Composite Transformations"); printf("\n\n Enter all coordinates values :"); scanf("%d %d %d %d %d %d",&xa,&ya,&xb,&yb,&xc,&yc); printf("\n\n The original Image"); /* get the coordinates for the original image*/ line(xa,ya,xb,yb); /* draw the original image*/ line(xb,yb,xc,yc); line(xc,yc,xa,ya); 42

43 printf("\n\n Enter the value tranlsation factor :"); /* get the translation factor*/ scanf("%d",&tx); 43

44 printf("\n\n After Translation "); x1a=xa+tx; x1b=xb+tx; x1c=xc+tx; y1a=ya; y1b=yb; y1c=yc; line(x1a,y1a,x1b,y1b); /* image after translation*/ line(x1b,y1b,x1c,y1c); line(x1c,y1c,x1a,y1a); delay(1); printf("\n\n Next Operation is Rotation"); printf("\n\n Enter the rotation angle :"); /* get the angle of rotation*/ scanf("%f",&ang); theta=((ang*3.14)/180); /* convert the angle*/ x2a=x1a*cos(theta)-y1a*sin(theta); y2a=x1a*sin(theta)+y1a*cos(theta); x2b=x1b*cos(theta)-y1b*sin(theta); y2b=x1b*sin(theta)+y1b*cos(theta); x2c=x1c*cos(theta)-y1c*sin(theta); y2c=x1c*sin(theta)+y1c*cos(theta); printf("\n\n After Rotation "); /* the rotated object*/ line(x2a,y2a,x2b,y2b); line(x2b,y2b,x2c,y2c); line(x2c,y2c,x2a,y2a); delay(1); printf("\n\n Next Operation is Scaling"); /* get the scale factor*/ printf("\n\n Enter the Scale factor :"); scanf("%f %f",&sx,&sy); x3a=x2a+sx; /* modify the objects coordinates based on the scale factor*/ y3a=y2a+sy; x3b=x2b+sx; 44

45 y3b=y2b+sy; x3c=x2c+sx; y3c=y2c+sy; printf("\n\n After Scaling "); line(x3a,y3a,x3b,y3b); line(x3b,y3b,x3c,y3c); line(x3c,y3c,x3a,y3a); delay(1); printf("\n\n Next Operation is Shearing"); printf("\n\n Enter 1 for x-axis \n 2 for y-axis: "); /* get the choice of shearing in the x or y axis*/ scanf("%d",&ch); if(ch==1) /* get the shear value*/ printf("\n\n Enter the x-shear (^.^) Value: "); scanf("%d",&shx); else printf("\n\n Enter the y-shear (^.^) Value: "); scanf("%d",&shy); if(ch==1) x3a=x3a+shx*y3a; y4a=y3a; x3b=x3a+shx*y3a; y4b=y3b; x3c=x3a+shx*y3a; y4c=y3c; else 45

46 46

47 x4a=x3a; y3a=y3a+shy*x3a; x4b=x3b; y3b=y3b+shy*x3b; x4c=x3c; y3c=y3c+shy*x3c; printf("\n\n After Shearing "); /* draw the final object after shearing*/ line(x3a,y3a,x3b,y3b); line(x3b,y3b,x3c,y3c); line(x3c,y3c,x3a,y3a); delay(1); printf("\n\n Next Operation is Reflection"); t=abs(y3ay3c); /* calculate the value for reflection*/ x5a=x3a; x5b=x3b; x5c=x3c; y5a=y3a+10+(2*t); y5b=y3b+10; y5c=y3c+10; printf("\n\n After Reflection "); /* the final object after all the transformations*/ line(x5a,y5a,x5b,y5b); line(x5b,y5b,x5c,y5c); line(x5c,y5c,x5a,y5a); getch(); closegraph(); return 0; 47

48 48

49 OUTPUT: 2D Composite Transformations Enter all coordinates values The original Image Enter the value translation vector 32 After Translation Next Operation is Rotation Enter the rotation angle 20 After Rotation Next Operation is Scaling Enter the scale factor

50 50

51 After Scaling Next Operation is Shearing Enter 0 for x axis and 1 for y axis 0 Enter the x-shear value 1 After Shearing Enter 0 for x axis and 1 for y axis 1 Enter the y-shear value 1 Next Operation is Reflection After Reflection 51

52 RESULT: Thus the Two dimensional Composite transformations were successfully executed and the output is transformed, drawn and verified. 52

53 6. IMPLEMENTATION OF LINE, CIRCLE AND ELLIPSE ATTRIBUTES DESCRIPTION: Output primitives have geometric and non-geometric attributes. Geometric attributes, such as the character height, affect the size and shape of a primitive, whereas non-geometric attributes are qualities such as colour, line style, etc. The output primitives Such as Line, Circle and Ellipse are associated with set of attributes such as Line (color and Line Style), Cicrle (Color) and Ellipse (Color and Patterns). CODING: #include<graphics.h> /* include the necessary header files*/ #include<stdlib.h> #include<stdio.h> #include<conio.h> int main(void) /* select a driver and mode that supports */ /* multiple drawing colors.*/ int gdriver=ega,detect,gmode=egahi,errorcode; int color,maxcolor,x,y,s,ch,ch1,ch2,i; int midx,midy; int radius=100; int xradius=100,yradius=50; char msg[80]; char *lname[]="solid Line", "Dotted Line", "Center Line", "Dashed Line", "Usebit Line"; /* initialize graphics and local variables */ initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); /* read result of initialization */ errorcode=graphresult(); if (errorcode!=grok) /* an error occurred */ printf("graphics error: %s\n", grapherrormsg(errorcode)); 53

54 54

55 printf("press any key to halt:"); getch(); exit(1); /* terminate with an error code */ do printf("\n1.line\n2.circle\n3.ellipse\n"); /* get the user choice*/ printf("\nenter Your choice\n"); scanf("%d",&ch); switch(ch) case 1: printf("attribute: 1.Color 2.Style:\n"); scanf("%d",&ch1); switch(ch1) case 1: maxcolor=getmaxcolor(); /* use predefined methods to change the color*/ x=getmaxx()/2; y=getmaxy()/2; for(color=1;color<=maxcolor;color++) cleardevice(); setcolor(color); line(100,100,100,300); sprintf(msg,"color:%d",color); outtextxy(x,y,msg); getch(); closegraph(); break; case 2: 55

56 initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); 56

57 for(s=0;s<5;s++) setlinestyle(s,1,1); /* pre defined method for linestyle*/ line(20,20+s*50,120,120+s*50); outtextxy(125,120+s*50,lname[s]); getch(); closegraph(); break; break; case 2: initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); midx=getmaxx()/2; midy=getmaxy()/2; maxcolor=getmaxcolor(); /* draw circles of different colors*/ for(color=1;color<=maxcolor;color++) cleardevice(); setcolor(color); /* draw the circle */ circle(midx,midy,radius); /* clean up */ getch(); closegraph(); break; case 3: printf("\n1.pattern 2.colour\n"); /* get choice for color or style of eclipse*/ printf("\nenter your choice:\n"); scanf("%d",&ch2); 57

58 switch(ch2) 58

59 default: case 1: /* initialize graphics and local variables */ initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); midx=getmaxx()/2; midy=getmaxy()/2; /* loop through the fill patterns */ for(i=empty_fill;i<user_fill;i++) /* set fill pattern */ setfillstyle(i,getmaxcolor()); /* draw a filled ellipse */ fillellipse(midx, midy, xradius, yradius); getch(); closegraph(); break; case 2: initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); maxcolor=getmaxcolor(); for(color=1;color<=maxcolor;color++) cleardevice(); setcolor(color); ellipse(100,200,0,360,xradius,yradius); getch(); /* clean up */ closegraph(); break; 59

60 60

61 while(ch==3); return 0; //exit(0); break; OUTPUT: Line Color Line Style 61

62 62

63 Circle Color Ellipse Pattern Ellipse Color 63

64 64

65 RESULT: verified. Thus the attributes were successfully applied to Line, circle and ellipse and the output is drawn and 65

66 7. IMPLEMENTATION OF SUTHERLAND HODGEMAN POLYGON CLIPPING ALGORITHM DESCRIPTION: The Sutherland Hodgeman Algorithm is used for clipping polygons. It works by extending each line of the convex clip polygon in turn and selecting only vertices from the subject polygon that is on the visible side. This algorithm performs a clipping of a polygon against each window edge in turn. It accepts an ordered sequence of vertices v1, v2, v3... vn and puts out a set of vertices defining the clipped polygon. CODING: #include<stdio.h> /* include the necessary header files*/ #include<graphics.h> #include<conio.h> #include<math.h> #include<process.h> #define TRUE 1 #define FALSE 0 typedef unsigned int outcode; outcode CompOutCode(float x,float y); /* create an user defined function for the output*/ enum TOP=0x1, BOTTOM=0x2, RIGHT=0x4, LEFT=0x8 ; float xmin,xmax,ymin,ymax; void clip(float x0,float y0,float x1,float y1) /* define the clipping function*/ outcode outcode0,outcode1,outcodeout; int accept=false,done=false; outcode0=compoutcode(x0,y0); /* call the user defined function*/ 66

67 67

68 outcode1=compoutcode(x1,y1); do /* assign the values for the condition variables*/ if(!(outcode0 outcode1)) accept=true; done=true; else if(outcode0&outcode1) done=true; else float x,y; outcodeout=outcode0?outcode0:outcode1; /* use the tertiary operator to assign values*/ if(outcodeout&top) /* reassign the value of x and y */ x=x0+(x1-x0)*(ymax-y0)/(y1-y0); y=ymax; else if(outcodeout&bottom) x=x0+(x1-x0)*(ymin-y0)/(y1-y0); y=ymin; else if(outcodeout&right) y=y0+(y1-y0)*(xmax-x0)/(x1-x0); x=xmax; 68

69 69

70 else y=y0+(y1-y0)*(xmin-x0)/(x1-x0); x=xmin; if(outcodeout==outcode0) x0=x; y0=y; outcode0=compoutcode(x0,y0); else x1=x; y1=y; outcode1=compoutcode(x1,y1); while(done==false); if(accept) line(x0,y0,x1,y1); outtextxy(150,20,"polygon AFTER CLIPPING"); rectangle(xmin,ymin,xmax,ymax); /* draw the clipping window*/ outcode CompOutCode(float x,float y) /* define the output function*/ outcode code=0; if(y>ymax) code =TOP; else if(y<ymin) 70

71 code =BOTTOM; if(x>xmax) code =RIGHT; else if(x<xmin) code =LEFT; return code; void main() float x1,y1,x2,y2; /* request auto detection */ int gdriver=detect,gmode,n,poly[14],i; clrscr( ); printf("enter the no of sides of polygon:"); /* get the sides of the polygon*/ scanf("%d",&n); printf("\nenter the coordinates of polygon\n"); for(i=0;i<2*n;i++) scanf("%d",&poly[i]); poly[2*n]=poly[0]; poly[2*n+1]=poly[1]; printf("enter the rectangular coordinates of clipping window\n"); scanf("%f%f%f%f",&xmin,&ymin,&xmax,&ymax); /* get the coordinates of the clipping window*/ /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, "c:\\tc\\bgi"); outtextxy(150,20,"polygon BEFORE CLIPPING"); drawpoly(n+1,poly); rectangle(xmin,ymin,xmax,ymax); getch(); cleardevice(); 71

72 for(i=0;i<n;i++) getch(); clip(poly[2*i],poly[(2*i)+1],poly[(2*i)+2],poly[(2*i)+3]); /* call the clipping function*/ restorecrtmode(); OUTPUT: Enter the Sides of the Polygon: 5 Enter the co-ordinates of the Polygon Enter the rectangular co-ordinates RESULT: Thus the Sutherland Hodgeman polygon clipping algorithm was successfully executed and the output is drawn and verified. 72

73 73

74 74

//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

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

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

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

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

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

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

February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA Lab Manual February 1 2014 COMPUTER GRAPHICS & MUTIMEDIA INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland Turbo C++ (Version 4.5) LIST

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

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

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

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

//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

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

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

'C' Programming Language

'C' Programming Language F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax

More information

CS COMPUTER GRAPHICS LAB

CS COMPUTER GRAPHICS LAB CS2405 - COMPUTER GRAPHICS LAB 1. Output primitives. 2. Implementation of Bresenhams Algorithm Line, Circle, Ellipse. 3. Implementation of Line, Circle and ellipse Attributes 4. Two Dimensional transformations

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition.

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. POLYNOMIAL ADDITION AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. ALGORITHM:- 1. Start the program 2. Get the coefficients and powers

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

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

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

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

Computers Programming Course 12. Iulian Năstac

Computers Programming Course 12. Iulian Năstac Computers Programming Course 12 Iulian Năstac Recap from previous course Strings in C The character string is one of the most widely used applications that involves vectors. A string in C is an array of

More information

AIM:- To write a C program to create a singly linked list implementation.

AIM:- To write a C program to create a singly linked list implementation. SINGLY LINKED LIST AIM:- To write a C program to create a singly linked list implementation. ALGORITHM:- 1. Start the program. 2. Get the choice from the user. 3. If the choice is to add records, get the

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

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

Module Contact: Dr Rudy Lapeer, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Rudy Lapeer, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2014-15 GRAPHICS 1 CMP-5010B Time allowed: 2 hours Answer THREE questions. Notes are not permitted in this examination

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management

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

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 217-18 GRAPHICS 1 CMP-51B Time allowed: 2 hours Answer THREE from FOUR questions (4 marks each) Notes are not permitted

More information

Snake Ladder Game. ifstream infile("c:\tc\bin\rattle.txt"); infile.getline(hs,4); infile.close(); hscore = atoi(hs);

Snake Ladder Game. ifstream infile(c:\tc\bin\rattle.txt); infile.getline(hs,4); infile.close(); hscore = atoi(hs); Snake Ladder Game #include #include #include #include #include #include #include #include void main(void) int gdriver=detect,

More information

UNIT 2 2D TRANSFORMATIONS

UNIT 2 2D TRANSFORMATIONS UNIT 2 2D TRANSFORMATIONS Introduction With the procedures for displaying output primitives and their attributes, we can create variety of pictures and graphs. In many applications, there is also a need

More information

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan Case Control Structure DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) Decision control

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

Lab-Report Digital Signal Processing. FIR-Filters. Model of a fixed and floating point convolver

Lab-Report Digital Signal Processing. FIR-Filters. Model of a fixed and floating point convolver Lab-Report Digital Signal Processing FIR-Filters Model of a fixed and floating point convolver Name: Dirk Becker Course: BEng 2 Group: A Student No.: 9801351 Date: 30/10/1998 1. Contents 1. CONTENTS...

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

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

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II)

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering nukhet.ozbek@ege.edu.tr Topics

More information

Arrays in C. By Mrs. Manisha Kuveskar.

Arrays in C. By Mrs. Manisha Kuveskar. Arrays in C By Mrs. Manisha Kuveskar. C Programming Arrays An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you

More information

1) Program to display a set of values {fij} as a rectangular mesh. #include<gl/glut.h> #define maxx 20. #define maxy 20. #define dx 15.

1) Program to display a set of values {fij} as a rectangular mesh. #include<gl/glut.h> #define maxx 20. #define maxy 20. #define dx 15. 1) Program to display a set of values fij as a rectangular mesh. #include #define maxx 20 #define maxy 20 #define dx 15 #define dy 20 GLfloat x[maxx]=0.0,y[maxy]=0.0; GLfloat x0=50,y01=50; GLint

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement UNIT- II: Control Flow: Statements and Blocks, if, switch statements, Loops: while, do-while, for, break and continue, go to and Labels. Arrays and Strings: Introduction, One- dimensional arrays, Declaring

More information

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of

More information

MODULE V: POINTERS & PREPROCESSORS

MODULE V: POINTERS & PREPROCESSORS MODULE V: POINTERS & PREPROCESSORS INTRODUCTION As you know, every variable is a memory-location and every memory-location has its address defined which can be accessed using ampersand(&) operator, which

More information

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data

More information

Annexure-I. #include<stdio.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<string.h>

Annexure-I. #include<stdio.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<string.h> Annexure-I #include #include #include #include #include #include #define GRID_COLOR 8 #define AXIS_COLOR 2 #define FAN_COLOR 12 #define MINE_COLOR

More information

Government Polytechnic Muzaffarpur.

Government Polytechnic Muzaffarpur. Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking

More information

UNIT 3 FUNCTIONS AND ARRAYS

UNIT 3 FUNCTIONS AND ARRAYS UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing

More information

BGI Graphics Engine Tutorial

BGI Graphics Engine Tutorial BGI Graphics Engine Tutorial Tutor: Anton Gerdelan Computer game program layout Computer games (and other graphical programs) have a recognisable program structure: #include library files Global variables

More information

Developed By: P.Venkateshwarlu, Alphores Womens Degree College, Karimnagar

Developed By: P.Venkateshwarlu, Alphores Womens Degree College, Karimnagar B.Sc (Computer Science) 1 sem Practical Solutions 1.Program to find biggest in 3 numbers using conditional operators. # include # include int a, b, c, big ; printf("enter three numbers

More information

DEPERTMENT OF CIVIL ENGINEERING RAJSHSHI UNIVERSITY OF ENGINEERING & TECHNOLOGY CE 206 NUMERICAL METHODS & COMPUTER PROGRAMMING SESSIONAL

DEPERTMENT OF CIVIL ENGINEERING RAJSHSHI UNIVERSITY OF ENGINEERING & TECHNOLOGY CE 206 NUMERICAL METHODS & COMPUTER PROGRAMMING SESSIONAL Heaven's Light Is Our Guide DEPERTMENT OF CIVIL ENGINEERING RAJSHSHI UNIVERSITY OF ENGINEERING & TECHNOLOGY CE 206 NUMERICAL METHODS & COMPUTER PROGRAMMING SESSIONAL Submitted by: Name : Md. Abdullah Asad

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

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 2nd Semester: 3rd Data Structures- PCS-303 LAB MANUAL Prepared By: HOD(CSE) DEV BHOOMI

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.

More information

Jaipur National University, Jaipur Dr. Rajendra Takale Prof. and Head Academics SBPIM, Pune

Jaipur National University, Jaipur Dr. Rajendra Takale Prof. and Head Academics SBPIM, Pune Computer Graphics Board of Studies Prof. H. N. Verma Vice- Chancellor Jaipur National University, Jaipur Dr. Rajendra Takale Prof. and Head Academics SBPIM, Pune Prof. M. K. Ghadoliya Director, School

More information

/* Area and circumference of a circle */ /*celsius to fahrenheit*/

/* Area and circumference of a circle */ /*celsius to fahrenheit*/ /* Area and circumference of a circle */ #include #include #define pi 3.14 int radius; float area, circum; printf("\nenter radius of the circle : "); scanf("%d",&radius); area = pi

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities Continuous Internal Evaluation Test 2 Date: 0-10- 2017 Marks: 0 Subject &

More information

List of Programs: Programs: 1. Polynomial addition

List of Programs: Programs: 1. Polynomial addition List of Programs: 1. Polynomial addition 2. Common operations on vectors in c 3. Matrix operation: multiplication, transpose 4. Basic Unit conversion 5. Number conversion: Decimal to binary 6. Number conversion:

More information

MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS SUB: COMPUTER LAB-II CLASS: S.E.CIVIL

MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS SUB: COMPUTER LAB-II CLASS: S.E.CIVIL MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS (Procedure for conduction of Practical/Term Work) SUB: COMPUTER LAB-II CLASS: S.E.CIVIL Prepared by Ms.V.S.Pradhan Lab In charge

More information

!"#$% &'($) *+!$ 0!'" 0+'&"$.&0-2$ 10.+3&2),&/3+, %&&/3+, C,-"!.&/+"*0.&('1 :2 %*10% *%7)/ 30'&. 0% /4%./

!#$% &'($) *+!$ 0!' 0+'&$.&0-2$ 10.+3&2),&/3+, %&&/3+, C,-!.&/+*0.&('1 :2 %*10% *%7)/ 30'&. 0% /4%./ 0!'" 0+'&"$ &0-2$ 10 +3&2),&/3+, #include int main() int i, sum, value; sum = 0; printf("enter ten numbers:\n"); for( i = 0; i < 10; i++ ) scanf("%d", &value); sum = sum + value; printf("their

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

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields:

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields: Assignment 6 Q1. Create a database of students using structures, where in each entry of the database will have the following fields: 1. a name, which is a string with at most 128 characters 2. their marks

More information

LABORATORY MANUAL. (CSE-103F) FCPC Lab

LABORATORY MANUAL. (CSE-103F) FCPC Lab LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana Aim: Main aim of this course is to understand and solve logical

More information

Module Contact: Dr R J Lapeer, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr R J Lapeer, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2012-13 GRAPHICS 1 CMPC2G04 Time allowed: 2 hours Answer THREE questions out of FOUR. (40 marks each) Notes are not permitted

More information

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation.

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation. Code No: R05221201 Set No. 1 1. (a) List and explain the applications of Computer Graphics. (b) With a neat cross- sectional view explain the functioning of CRT devices. 2. (a) Write the modified version

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

Computer Programming Unit 3

Computer Programming Unit 3 POINTERS INTRODUCTION Pointers are important in c-language. Some tasks are performed more easily with pointers such as dynamic memory allocation, cannot be performed without using pointers. So it s very

More information

ME 172. C Programming Language Sessional Lecture 8

ME 172. C Programming Language Sessional Lecture 8 ME 172 C Programming Language Sessional Lecture 8 Functions Functions are passages of code that have been given a name. C functions can be classified into two categories Library functions User-defined

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6504-COMPUTER GRAPHICS Anna University 2 & 16 Mark Questions & Answers Year / Semester: III / V Regulation:

More information

A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables.

A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables. Lecture 9 Pointers A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables. This variable may be of type int, char,

More information

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA INTERNAL ASSESSMENT TEST 2 (Scheme and Solution) Data Structures Using C (16MCA11) 1) A.

More information

More examples for Control statements

More examples for Control statements More examples for Control statements C language possesses such decision making capabilities and supports the following statements known as control or decision-making statements. 1. if statement 2. switch

More information

Computer Graphics Course Notes

Computer Graphics Course Notes Clipping Algorithms Real world objects can be represented relative to a reference world coordinate system. It is difficult to view all the objects on computer screen at the same time in one screen shot

More information

Programming and Data Structures

Programming and Data Structures Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()

More information

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI) Lab Manual Computer Graphics T.E. Computer (Sem VI) Index Sr. No. Title of Programming Assignments Page No. 1. Line Drawing Algorithms 3 2. Circle Drawing Algorithms 6 3. Ellipse Drawing Algorithms 8 4.

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

Test Paper 1 Programming Language 1(a) What is a variable and value of a variable? A variable is an identifier and declared in a program which hold a value defined by its type e.g. integer, character etc.

More information

Flow of Control. Selection. if statement. True and False in C False is represented by any zero value. switch

Flow of Control. Selection. if statement. True and False in C False is represented by any zero value. switch Flow of Control True and False in C Conditional Execution Iteration Nested Code(Nested-ifs, Nested-loops) Jumps 1 True and False in C False is represented by any zero value The int expression having the

More information

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List in Data Structure By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List Like arrays, Linked List is a linear data

More information

MODULE 1. Introduction to Data Structures

MODULE 1. Introduction to Data Structures MODULE 1 Introduction to Data Structures Data Structure is a way of collecting and organizing data in such a way that we can perform operations on these data in an effective way. Data Structures is about

More information

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS2401 COMPUTER GRAPHICS QUESTION BANK PART A UNIT I-2D PRIMITIVES 1. Define Computer graphics. 2. Define refresh

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes

More information

Unit 3 Transformations and Clipping

Unit 3 Transformations and Clipping Transformation Unit 3 Transformations and Clipping Changes in orientation, size and shape of an object by changing the coordinate description, is known as Geometric Transformation. Translation To reposition

More information

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C 0 0 3 2 1.Create a Stack and do the following operations using arrays and linked lists (i)push (ii) Pop (iii) Peep 2.Create a Queue and do the following

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

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

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks) Figure 1: A perspective view of a polyhedron on an infinite plane. Cameras and Perspective Rendering

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

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff;

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff; /* Polynomial Expressions Using Linked List*/ #include #include #include struct node int num; int coeff; struct node *next; ; struct node *start1 = NULL; struct node *start2

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17212 Model Answer Page No: 1/28 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model

More information

Data Structures and Algorithms (DSA) Course 4. Iulian Năstac

Data Structures and Algorithms (DSA) Course 4. Iulian Năstac Data Structures and Algorithms (DSA) Course 4 Iulian Năstac 10. Functions for dynamic memory allocation (recapitulation) Dynamic allocation is a specific characteristic allowed by some computing languages,

More information