#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#define Pi 3.1415926
main()
{ int gdriver=DETECT,gmode;
float i,j;
int k;
float a,b,c;
float mid,m,x,y,z;
float u,v;
int col1,col2;
printf("enter the color value :");
scanf("%d %d",&col1,&col2);
initgraph(&gdriver,&gmode,"");
cleardevice();
for(i=0;i<=1.91;i+=1.91/75)
{
for(j=0;j<=21.6;j+=21.6/150)
{
for(k=1;k<=200;k++)
{
c=j;
a=sqrt(60*c)*cos(k*Pi/180*1.8);
b=sqrt(60*c)*sin(k*Pi/180*1.8);
mid=a*a+b*b+900;
m=450+a*a+b*b-30*c-a*i;
x=i+2*a*m/mid;
y=2*b*m/mid;
z=-(15*(900+3*a*a+3*b*b-120*c-4*a*i))/mid;
u=(25015*a-25015*x+c*x-a*z)/(c-z);
v=(25015*b-25015*y+c*y-b*z)/(c-z);
u/=10;
v/=10;
putpixel(u+320,v+280,col1);
putpixel(320-u,v+280,col2);
}
}
}
getch();
closegraph();
}
评论