glib.h
资源名称:fenxin.rar [点击查看]
上传用户:hzcygd
上传日期:2022-04-30
资源大小:109k
文件大小:1k
源码类别:
分形几何
开发平台:
Visual C++
- #include <math.h>
- #define PI M_PI
- #define END 1995.6
- double ANGLE=0,RADIAN=0;//当前角的角度和弧度
- double LPX=0,LPY=0;//当前位置的X,Y坐标
- void __fastcall set0(int x0,int y0)//设置原点
- {SetWindowOrgEx(Form1->Image1->Canvas->Handle,0,0,NULL);
- SetViewportOrgEx(Form1->Image1->Canvas->Handle,x0,y0,NULL);
- }
- void __fastcall setlp(double lpx,double lpy)//设置当前位置
- {LPX=lpx;LPY=lpy;
- }
- void __fastcall setangle(double angle)//设置当前角度
- {ANGLE=angle;
- RADIAN=ANGLE*M_PI/180;
- }
- void __fastcall turn(double angle)//旋转当前角度
- {ANGLE+=angle;
- ANGLE=ANGLE-(int)ANGLE+(int)ANGLE%360;
- RADIAN=ANGLE*M_PI/180;
- }
- void __fastcall warp(double length)//弯曲指定距离
- {LPX+=length*cos(RADIAN);
- LPY-=length*sin(RADIAN);
- }
- void __fastcall move(double length)//画线
- {Form1->Image1->Canvas->MoveTo(LPX,LPY);
- Form1->Image1->Canvas->LineTo((LPX+=length*cos(RADIAN)),
- (LPY-=length*sin(RADIAN)));
- }
- void __fastcall putpixel(int x,int y,TColor col)//设置点的颜色
- {Form1->Image1->Canvas->Pixels[x][y]=col;
- }