【溫馨提示】 dwg后綴的文件為CAD圖,可編輯,無水印,高清圖,,壓縮包內(nèi)文檔可直接點開預覽,需要原稿請自助充值下載,請見壓縮包內(nèi)的文件及預覽,所見才能所得,請細心查看有疑問可以咨詢QQ:414951605或1304139763
附件:
動臂、鏟斗運動仿真:
#include "stdio.h"
#include "math.h"
#include "graphics.h"
#define pi 3.1415926
main()
{
float l1 , l2 , l3 , l4 , a , b;
int x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4;
int gdriver=DETECT,gmode;
initgraph (&gdriver ,&gmode , "c:\\mydocuments\\tc");
cleardevice();
line(20,460,400,460);
line(20,460,20,20);
circle(20,230,3);
circle(20,320,3);
l1=sqrt(pow(119,2)+pow(130,2));
l2=sqrt(pow(210,2)+pow(230,2));
x2=(int)(12*sin(135*(pi/180)));
y2=(int)(230-12*cos(135*(pi/180)));
l3=sqrt(pow((250-x2),2)+pow((460-y2),2));
l4=sqrt(pow((240-x2),2)+pow((y2-430),2));
x1=(int)(l1*sin(135*(pi/180)));
y1=(int)(230-l1*cos(135*(pi/180)));
circle(250,460,3);
circle(240,460,3);
line(x2,y2,250,460);
line(x2,y2,240,430);
line(240,430,250,460);
b=60*(pi/180);
for(a=70*(pi/180);a<145*(pi/180);a+=pi/180)
{cleardevice();
line (20,460,400,460);
line(20,460,20,20);
circle(20,230,3);
circle(20,320,3);
line(20,230,x1,y1);
line(x1,y1,x2,y2);
circle(x2,y2,3);
line(20,320,x1,y1);
circle(x1,y1,3);
x3=x2+l3*sin(a);
y3=y2+l3*cos(a);
x4=x2+l4*sin(a+b);
y4=y2+l4*cos(a+b);
circle(x3,y3,3);
circle(x4,y4,3);
line(x2,y2,x3,y3);
line(x2,y2,x4,y4);
line(x3,y3,x4,y4);
getch();
}
for (a=135*(pi/180);
a>50*(pi/180);
a-=pi/120)
{
line (20,460,400,460);
line (20,460,20,20);
circle(20,230,3);
circle(20,320,3);
x1=(int)(l1*sin(a));
y1=(int)(230-l1*cos(a));
circle(x1,y1,3);
line(20,320,x1,y1);
line(20,230,x1,y1);
x2=(int)(12*sin(a));
y2=(int)(230-12*cos(a));
circle(x2,y2,3);
line(x1,y1,x2,y2);
getch();
}
getch();
}