














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Computer scienceand graphi and multimedia subject
Typology: Study notes
1 / 22
This page cannot be seen from the preview
Don't miss anything!















line(x3,y3,x4,y4); line(x4,y4,x1,y1); setcolor(5); gotoxy(1,25); printf("\n\t Enter the reference point xr & yr:"); scanf("%d%d",&xr,&yr); putpixel(xr,yr,5); printf("\n\t Enter the angle:"); scanf("%d",&r); t=r3.14/180.0; x11=floor(xr+(x1-xr)cos(t)-(y1-yr)sin(t)); y11=floor(yr+(x1-xr)sin(t)+(y1-yr)cos(t)); x22=floor(xr+(x2-xr)cos(t)-(y2-yr)sin(t)); y22=floor(yr+(x2-xr)sin(t)+(y2-yr)cos(t)); x33=floor(xr+(x3-xr)cos(t)-(y3-yr)sin(t)); y33=floor(yr+(x3-xr)sin(t)+(y3-yr)cos(t)); x44=floor(xr+(x4-xr)cos(t)-(y4-yr)sin(t)); y44=floor(yr+(x4-xr)sin(t)+(y4-yr)*cos(t)); setcolor(15); setlinestyle(0,1,1); line(x11,y11,x22,y22); line(x22,y22,x33,y33); line(x33,y33,x44,y44); line(x44,y44,x11,y11); }
Enter the x1 & y1 value L:250 300 Ente the x2 & y2 value L:250 400 Enter the x3 & y3 value L:500 400 Enter the x4 & y4 value L:500 300 2D-ROTATION Enter the reference point xr & yr: 250 300 Enter the angle: 90
outtextxy(150,20,"hai welcome to my world"); outtextxy(150,320,"hai"); outtextxy(200,320,"welcome"); outtextxy(273,20+i,"to"); cleardevice(); } } void drop::display4() { for(i=1;i<=300;i++) { outtextxy(150,20,"hai welcome to my world"); outtextxy(150,20,"hai"); outtextxy(200,320,"welcome"); outtextxy(273,320,"to"); outtextxy(303,20+i,"my"); delay(10); cleardevice(); } } void drop::display5() { for(i=0;i<=300;i++) { outtextxy(150,20,"hai welcome to my world"); outtextxy(200,320,"hai"); outtextxy(200,320,"welcome"); outtextxy(200,320,"to"); outtextxy(303,320,"my"); outtextxy(343,20+i,"world"); delay(10); cleardevice(); } } voidmain() { int gm,gd=DETECT; initgraph(&gd,&gm,"C:\TurboC3\BGI"); drop d; d.display(); d.display1(); d.display2(); d.display3(); d.display4(); d.display5(); outtextxy(150,150,"hai welcome to my world");getch(); }
hai welcome to my world world my to welcome hai hai welcome to my world
Enter the value of [x1,y1]:150 200 Enter the value of [x2,y2]:200 150
#include<graphics.h> #include<conio.h> #include<math.h> #include<dos.h> int midx,midy,maxx,maxy; void displaycar(int c,int k) { setcolor(c); ellipse(50+k,midy+40,0,360,10,10); ellipse(100+k,midy+40,0,360,10,10); line(60+k,midy+40,90+k,midy+40); line(20+k,midy+40,40+k,midy+40); line(110+k,midy+40,130+k,midy+40); line(20+k,midy+40,20+k,midy+20); line(130+k,midy+40,130+k,midy+20); line(20+k,midy+20,30+k,midy+20); line(130+k,midy+20,100+k,midy+20); line(30+k,midy+20,30+k,midy); line(100+k,midy+20,100+k,midy); line(30+k,midy,100+k,midy); } void main() { int gd=DETECT,gm; int k=-20; initgraph(&gd,&gm,"C:\TurboC3\BGI"); midx=(maxx=getmaxx())/2; midy=(maxy=getmaxy())/2; line(0,midy-50,maxx,midy-50); line(0,midy+51,maxx,midy+51); setbkcolor(0); while(!kbhit()) { displaycar(5,k); sound(700); delay(50); displaycar(0,k-5); k+=5; if(k>=maxx) k=-20; } nosound(); getch(); closegraph(); }
#include<dos.h> #include<graphics.h> #include<math.h> #include<conio.h> void main() { int gd=DETECT,gm,k; float x=1,y=0.00000,j=.5,count=.1; float r=10,i; initgraph(&gd,&gm,"C:\TurboC3\BGI"); setcolor(10); line(0,415,650,415); sleep(1); for(k=0;k<+7;k++) { for(i=90;i<270;i+=10) { y=cos(((i22/7)/180))/j; if(y>0) y=-y; x+=5; setcolor(10); setfillstyle(1,10); circle(x,y100+400,10); delay(100); nosound(); setcolor(0); setfillstyle(1,10); circle(x,y100+400,r); floodfill(x,y100+400,0); } sound(500); j+=count; count+=0.1; } nosound(); getch(); closegraph(); }
Enter no.of points used: Enter the co-ordinative points:50 100 Enter the co-ordinative points:150 200 Enter the co-ordinative points:100 50 Enter the co-ordinative points:200 150 Enter the finding pixel co-ordinate values:250 200 Given pixel are outside the polygon Enter no.of points used: Enter the co-ordinative points:50 100 Enter the co-ordinative points:150 200 Enter the co-ordinative points:100 50 Enter the co-ordinative points:200 150 Enter the finding pixel co-ordinate values:50 100 Given pixel are inside the polygon