drawLeaf(CClientDC dc, int x, int y, int L, double A)
{
CPen NewPen(PS_SOLID,1,RGB(0,0,0));//
CPen OldPen(PS_SOLID,1,RGB(255,255,255));
if(isD)dc.SelectObject(NewPen);
else dc.SelectObject(OldPen);
double B=50;//
double C=9;//
double s1=2;//、
double s2=3;//
double s3=1.3;//
int x1,y1;
int x1L,y1L;
int x1R,y1R;
int x2,y2;
int x2R,y2R;
int x2L,y2L;
if(L>s1)
{
x2=int(x+L*cos(A*PI));//
y2=int(y+L*sin(A*PI));
x2R=int(x2+L/s2*cos((A+B)*PI));
y2R=int(y2+L/s2*sin((A+B)*PI));
x2L=int(x2+L/s2*cos((A-B)*PI));
y2L=int(y2+L/s2*sin((A-B)*PI));
x1=int(x+L/s2*cos(A*PI));
y1=int(y+L/s2*sin(A*PI));
x1R=int(x1+L/s2*cos((A-B)*PI));
y1R=int(y1+L/s2*sin((A-B)*PI));
x1L=int(x1+L/s2*cos((A+B)*PI));
y1L=int(y1+L/s2*sin((A+B)*PI));
dc.MoveTo(x,y);
dc.LineTo(x2,y2);
dc.LineTo(x2L,y2L);
dc.MoveTo(x2,y2);
dc.LineTo(x2R,y2R);
dc.MoveTo(x1,y1);
dc.LineTo(x1L,y1L);
dc.MoveTo(x1,y1);
dc.LineTo(x1R,y1R);
drawLeaf(this,int(x2),int(y2),int(L/s3),A+C);
drawLeaf(this,int(x2R),int(y2R),int(L/s2),A+B);
drawLeaf(this,int(x2L),int(y2L),int(L/s2),A-B);
drawLeaf(this,int(x1L),int(y1L),int(L/s2),A+B);
drawLeaf(this,int(x1R),int(y1R),int(L/s2),A-B);
}
}
baidu 2010-10-28 12:45