返回列表 发帖

猴子兄弟的范例

point a,b;
int n;
for(int i=1;i<5;i++)
{
n=2*i+1;
a=point(n,0);
  for(double fAngle=0.05/i;fAngle<=3.141593;fAngle+=0.05/i)
{
  b=point(sin(n*fAngle)*cos(fAngle)+n,sin(n*fAngle)*sin(fAngle));
  line(a,b,"",i);
  a=b;
}

}

point ptA,ptB;
int n;

for(int i=1;i<=6;i++)
{
n=i+1;
ptA=point(2*n,0);
  for(double fAngle=0.05/i;fAngle<=3.141593;fAngle+=0.05/i)
{
  ptB=point(sin(n*fAngle)*cos(fAngle)+2*n,sin(n*fAngle)*sin(fAngle));
  line(ptA,ptB,"",i);
  ptA=ptB;
}

  ptB=point(2*n,0);
  line(ptA,ptB,"",i);
}

TOP

//克莱线
double R;
point ptA,ptB;
ptA=point(4,0);
for(double dAngle=0.05;dAngle<=10;dAngle+=0.05)
{
R=4*pow(cos(dAngle/3),3);
ptB=point(R*cos(dAngle),R*sin(dAngle));
line(ptA,ptB);
ptA=ptB;
}

TOP

//费马螺线 r^2=angle
double R;
point ptA,ptB;
ptA=point(0,0);
for(double dAngle=0.05;dAngle<=10;dAngle+=0.05)
{
R=sqrt(dAngle);
ptB=point(R*cos(dAngle),R*sin(dAngle));
line(ptA,ptB);
ptA=ptB;
}

TOP

//心脏线 r=1-sin(angle)
double R;
point ptA,ptB;
ptA=point(1,0);
for(double dAngle=0.05;dAngle<=6.3;dAngle+=0.05)
{
R=1-sin(dAngle);
ptB=point(R*cos(dAngle),R*sin(dAngle));
line(ptA,ptB);
ptA=ptB;
}

TOP

sample.jpg
2012-9-29 04:41

TOP

返回列表