插补程序源代码

上传人:cl****1 文档编号:564578678 上传时间:2023-12-08 格式:DOC 页数:14 大小:63KB
返回 下载 相关 举报
插补程序源代码_第1页
第1页 / 共14页
插补程序源代码_第2页
第2页 / 共14页
插补程序源代码_第3页
第3页 / 共14页
插补程序源代码_第4页
第4页 / 共14页
插补程序源代码_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《插补程序源代码》由会员分享,可在线阅读,更多相关《插补程序源代码(14页珍藏版)》请在金锄头文库上搜索。

1、精选优质文档-倾情为你奉上插补程序源代码目录1逐点比较法插补c语言程序源代码022 逐点比较法圆弧插补VB源程序073 逐点比较法直线插补VB源程序114 时间分割法直线插补参考VB程序135 时间分割法圆弧插补VB源程序141 逐点比较法插补c语言程序源代码 #include conio.h #include graphics.h #include process.h #define Ni_circle 0 #define Shun_circle 1 void init_graph(); void draw_Base_circle(); void draw_cabu_circle(); vo

2、id close_graph(); void acrroods(); static float x0,y0; void line_cabu(), draw_line(),draw_line_cabu(); void line_cabu() /*此函数控制直线插步两次*/ int i; init_graph(); sleep(1); for(i=0;i2;i+) line(0,120,300,120); outtextxy(310,120,Z); line(100,10,100,300); outtextxy(110,300,X); outtextxy(90,130,O); draw_line(

3、); if(i=0) draw_line_cabu(6); else draw_line_cabu(2); gotoxy(50,5); getch(); cleardevice(); setcolor(WHITE); void draw_line()/*画直线*/ line(100,120,600,450); textcolor(YELLOW); directvideo=0; gotoxy(45,5); cprintf(Line from:X0 Y0 Z0 ); gotoxy(45,6); cprintf(Line to :X500 Y0 Z330); gotoxy(45,7); cprint

4、f(Units :Pixel); gotoxy(45,8); cprintf(Line now:); void draw_line_cabu(int step)/*关键的直线插补函数*/ int Xe=600,Ye=450; float Fm,Xm=100,Ym=120; setcolor(RED); moveto(Xm,Ym); while(Xm=Xe&Ym=0) Xm=Xm+step; else Ym=Ym+step; lineto(Xm,Ym); gotoxy(55,8); printf(X%3.0f Y0 Z%3.0f,Xm-100,Ym-120); delay(1100); /* 圆

5、插补部分的函数区*/ void init_graph() /*图形系统初始化*/ int gdrive=DETECT,gmode; initgraph(&gdrive,&gmode,); cleardevice(); void acrroods() /*屏幕中心坐标*/ x0=getmaxx()/2; y0=getmaxy()/2; void draw_Base_circle() /*画圆及写参数*/ line(x0-200,y0,x0+200,y0); outtextxy(x0+220,y0,Z); line(x0,y0-180,x0,y0+180); outtextxy(x0+10,y0+

6、180,X); outtextxy(x0-10,y0+10,O); circle(x0,y0,150); textcolor(YELLOW); directvideo=0; gotoxy(46,2);cprintf(Circle start:X0 Y0 Z150); gotoxy(46,3);cprintf(Circle end :X0 Y0 Z150); gotoxy(46,4);cprintf(Units :Pixel); gotoxy(46,5);cprintf(Circle now:); void close_graph() /*关图形系统*/ closegraph(); void d

7、raw_cabu_circle(int sstep,int Directory)/*关键的圆插补函数*/ int flag=0; float Fm,Xm,Ym; Xm=x0+150; Ym=y0; moveto(Xm,Ym); setcolor(RED); while(1) /*分象限,顺圆和逆圆讨论*/ Fm=(Xm-x0)*(Xm-x0)+(Ym-y0)*(Ym-y0)-150*150;/*圆判断公式*/ if(Fm=0) if(!Directory) /*逆圆判断*/ if(Xm=x0&Ym=y0) if(flag) break; /*if语句判断象限,以下一样*/ else Xm=Xm

8、-sstep; if(Xm=x0&Ym=y0) flag=1; Ym=Ym+sstep; if(Xm=y0) Xm=Xm+sstep; if(Xm=x0&Ym=y0) Ym=Ym-sstep; else /*it is Directorys else*/ if(Xmx0&Ymy0) Ym=Ym+sstep; if(Xm=x0&Ym=y0) Xm=Xm+sstep; if(Xmy0) flag=1; Ym=Ym-sstep; if(Xm=x0&Ym=y0) if(flag) break; Xm=Xm-sstep; else /*it is Fms else*/ if(!Directory) if(Xmx0&Ymy0) if(flag) break; else Ym=Ym-sstep; if(Xm=x0&Ym=y0) flag=1; Xm=Xm-sstep; if(Xm=y0) Ym=Ym+sstep; if(Xm=x0&Ym=y0) Xm=Xm+sstep;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号