Professional Documents
Culture Documents
Just Programming - Computer Graphics - Keviv03
Just Programming - Computer Graphics - Keviv03
Share
More
Next Blog
Create Blog
Just Programming
Home C Programs C++ Programs Data Structure Programming Q&A
SEARCH TOPICS HERE... CATEGORIES
C++ (25) Java (20) C Program (18) Programming Skills (16) Data Structure (15) Computer Graphics (8) Security Tips (7) UML Modeling (7) Actionscript 3.0 (1) PHP (1) PL/SQL (1)
POPULAR POSTS
To Implement Graph using Adjacency List in C Program to implement Graph using Adjacency List and traversing using DFS and BFS in C #include<stdio.h> #include<conio.h&... C++ program to check whether a string is palindrome or not Write a function that checks whether a string is Palindrome or not. Use this function to check user-entered strings. Also count and displa... Sparse Matrix using Array in C Program to implement Sparse Matrix using Array in C language #include<stdio.h> #include<conio.h> int spa[10][10]; void... Use case Diagram of Online Airline Reservation System
Members (3)
BLOG ARCHIVE
2013 (11) 2012 (92) November (1) October (4) Mid Point Circle Algorithm Implementation in C
http://keviv03.blogspot.in/search/label/Computer%20Graphics
1/13
2/2/2014
return; }
plotcircle(int xcenter,int ycenter,int x,int y) { putpixel(xcenter+x,ycenter+y,10); putpixel(xcenter-x,ycenter+y,10); putpixel(xcenter+x,ycenter-y,10); putpixel(xcenter-x,ycenter-y,10); putpixel(xcenter+y,ycenter+x,10); putpixel(xcenter-y,ycenter+x,10); putpixel(xcenter+y,ycenter-x,10); putpixel(xcenter-y,ycenter-x,10); // asterik lines (2 cross lines) putpixel(xcenter+x,ycenter-x,10); putpixel(xcenter-x,ycenter+x,10); putpixel(xcenter-x,ycenter-x,10); putpixel(xcenter+x,ycenter+x,10); return; }
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
2/13
2/2/2014
putpixel(xc+x,yc-y,15); putpixel(xc-x,yc-y,15); 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); } r=r-10; //xc=xc-5; //yc=yc-5; } getch(); closegraph(); }
Posted by vivek kumar
funny (0)
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
3/13
2/2/2014
break; } else if(outcode1 & outcode2) break; else { int x,y;
int outcodeout=outcode1?outcode1:outcode2; if(outcodeout & TOP) { x=x1+(x2-x1)*(ymax-y1)/(y2-y1); y=ymax; } else if(outcodeout & BOTTOM) { x=x1+(x2-x1)*(ymin-y1)/(y2-y1); y=ymin; } else if(outcodeout & RIGHT) { y=y1+(y2-y1)*(xmax-x1)/(x2-x1); x=xmax; } else { y=y1+(y2-y1)*(xmin-x1)/(x2-x1); x=xmin; } if(outcodeout == outcode1) { x1=x; y1=y; outcode1=code(x1,y1,xmin,ymin,xmax,ymax); } else { x2=x; y2=y; outcode2=code(x2,y2,xmin,ymin,xmax,ymax); } } } if(accept) { rectangle(xmin,ymin,xmax,ymax); line(x1,y1,x2,y2); } } int main() { int x1,y1,x2,y2,tx,ty,xmin,ymin,xmax,ymax; xmin=150; ymin=150; xmax=350; ymax=350; /*initwindow(1000,700,"Cohen Sutherland");*/ cout<<"\n Enter the initial points of the line : "; cout<<"\n X-axis : "; cin>>x1; cout<<" Y-axis : "; cin>>y1; cout<<"\n Enter the final points of the line : "; cout<<"\n X-axis : ";
http://keviv03.blogspot.in/search/label/Computer%20Graphics
4/13
2/2/2014
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
5/13
2/2/2014
initwindow(1000,700,"Scaling"); int i,z; for(i=0;i<y-1;i++) { line(matrix[0][i],matrix[1][i],matrix[0][i+1],matrix[1][i+1]); } line(matrix[0][i],matrix[1][i],matrix[0][0],matrix[1][0]); cout<<"\n\nScaled Matrix:\n"; for(int j=0;j<3;j++) { for(int k=0;k<y;k++) { m2[j][k]=0; for(int l=0;l<3;l++) m2[j][k]+=factor[j][l]*matrix[l][k]; cout<<m2[j][k]<<" "; } cout<<"\n"; } for(z=0;z<y-1;z++) { line(m2[0][z],m2[1][z],m2[0][z+1],m2[1][z+1]); } line(m2[0][z],m2[1][z],m2[0][0],m2[1][0]); while(!kbhit()){}
http://keviv03.blogspot.in/search/label/Computer%20Graphics
6/13
2/2/2014
return 0; }
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
7/13
2/2/2014
initwindow(1000,700,"Translation"); int i,z; for(i=0;i<y-1;i++) { line(matrix[0][i],matrix[1][i],matrix[0][i+1],matrix[1][i+1]); } line(matrix[0][i],matrix[1][i],matrix[0][0],matrix[1][0]); cout<<"\n\nTranslated Matrix:\n"; for(int j=0;j<3;j++) { for(int k=0;k<y;k++) { m2[j][k]=0; for(int l=0;l<3;l++) m2[j][k]+=factor[j][l]*matrix[l][k]; cout<<m2[j][k]<<" "; } cout<<"\n"; }
http://keviv03.blogspot.in/search/label/Computer%20Graphics
8/13
2/2/2014
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
9/13
2/2/2014
else { y=y+inc;p=p+2*(dy-dx); } x++; } } else { p=2*dx-dy; if(y1<y2) { y=y1;x=x1;end=y2; if(x1<x2)inc=1; if(x1>x2)inc=-1; } else { y=y2;x=x2;end=y1; if(x2<x1)inc=1; if(x2>x1)inc=-1; } while(y<=end) { putpixel(x,y,15); if(p<0)p=p+2*dx; else { x=x+inc;p=p+2*(dx-dy); } y++; if(current==0&&c==10) { current=1;c=-1; } if(current==1&&c==6) { current=0;c=-1; } c++; } } } void main() { int gdriver=DETECT,gmode,i,j,c=0; initgraph(&gdriver,&gmode,"..\\bgi"); for(i=1;i<=5;i++) { bress(100+c,100+c,300+c,100+c); bress(100+c,100+c,100+c,200+c); bress(300+c,100+c,300+c,200+c); bress(100+c,200+c,300+c,200+c); c+=10; } getch(); closegraph(); getch(); }
Posted by vivek kumar
funny (0)
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
10/13
2/2/2014
0 comments
interesting (0) cool (0)
http://keviv03.blogspot.in/search/label/Computer%20Graphics
11/13
2/2/2014
http://keviv03.blogspot.in/search/label/Computer%20Graphics
12/13
2/2/2014
0 comments
interesting (0) cool (0)
Home
Subscribe to: Posts (Atom)
Older Posts
COPYRIGHT PROTECTION
http://keviv03.blogspot.in/search/label/Computer%20Graphics
13/13