Tuesday, November 17, 2009

CG PROGRAMS

HERE's THE LINK FOR ALL THE FOLLOWING CG PROGRAM

if u find any error's or if u have a better version of the program please do mail me at jekintrivedi@gmail.com

http://www.turboupload.com/hdhldsv3oubd/CG_final.zip


Suggested Experiment List
1. Bresenham line drawing algorithm
2. 2D Transformation
3. 3D Transformation
4. Line Clipping Algorithm (Cohen - Sutherland & Liang - Barsky)
5. Polygon Clipping Algorithms
6. Projections
7. Polygon Filling Algorithms
8. Generation of 2D Curves
9. Fractals
10. Study of VR Architectures
11. Designing a Virtual Model (Geometric, Kinematics etc.)
12. VR Programming using toolkits


Here's is a super cool variation of fractal program called Sepenski gasket fractal given in Moorey thanks 2 anvith for mail it to me


#include iostream.h
#include conio.h
#include graphics.h

void create(int m1,int n1,int m2,int n2,int m3, int n3){
int p1,q1,p2,q2,p3,q3,u1,u2,u3,v1,v2,v3;
p1=(m1+m2)/2;p2=(m3+m2)/2;p3=(m1+m3)/2;
q1=(n1+n2)/2;q2=(n3+n2)/2;q3=(n1+n3)/2;
u1=m1;u2=m2;u3=m3;v1=n1;v2=n2;v3=n3;
line(p1,q1,p2,q2);line(p3,q3,p2,q2);line(p1,q1,p3,q3);
if((p1==p2 && p1==p3)||(q1==q2 && q1==q3))
return;
create(u1,v1,p1,q1,p3,q3);
create(p1,q1,u2,v2,p2,q2);
create(p3,q3,p2,q2,u3,v3);
}
void main(){
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
int x1,x2,x3,y1,y2,y3;
x1=100,y1=100;x2=100;y2=400;y3=400;x3=400;
line(x1,y1,x2,y2);line(x2,y2,x3,y3);line(x3,y3,x1,y1);
create(x1,y1,x2,y2,x3,y3);
getch();
closegraph();
}

No comments:

Post a Comment

JTSEARCH