计算机辅助设计.docx
- 文档编号:25040507
- 上传时间:2023-06-04
- 格式:DOCX
- 页数:25
- 大小:31.02KB
计算机辅助设计.docx
《计算机辅助设计.docx》由会员分享,可在线阅读,更多相关《计算机辅助设计.docx(25页珍藏版)》请在冰豆网上搜索。
计算机辅助设计
作业二
已知如图,求各主点里程及坐标。
(线路起点里程0Km)
2
1
R=800m
l01=60m
l02=60m
0
编写程序如下:
#include
#include
#definePI3.14159
main()
{
doublex0,y0,K0,x2,y2,K2,x1,y1,R,l01,l02;
doubleA,A12,A01;
doubleb01,b02,p1,p2,m1,m2,b1;
doubleT1,T2,L,r1,r2,E0;
doubleD01,D02,KZH,KHY,KQZ,KYH,KHZ;
doubleXZH,YZH,XHZ,YHZ,xHY,yHY,XHY,YHY,XYH,YYH;
doubleKZ1=0.0,KH1=10.0,KY=0.0,KH2=0.0,KZ2=0.0;
doubleX[60],Y[60],x[60],y[60],dr[60];
doublel10,l20;
inti=1,j,k;
x0=0.0;y0=0.0;K0=0.0;
x2=5156.0;y2=8316.0;
x1=4000.0;y1=4000.0;
R=800.0;l01=60.0;l02=60.0;
printf("计算转角\n");
A12=atan((y2-y1)/(x2-x1));
A01=atan((y1-y0)/(x1-x0));
A=(A12-A01)*180/PI;/*把A从弧度转为°*/
if(A>0)printf("曲线右转\n");
if(A<0)printf("曲线左转\n");
printf("\n");
/*计算曲线要素*/
printf("计算曲线要素\n");
printf("缓和曲线常数\n");
b01=(l01/(2*R))*180/PI;/*把b01从弧度转为°*/
b02=(l02/(2*R))*180/PI;/*把b02从弧度转为°*/
p1=(l01*l01)/(24*R);
p2=(l02*l02)/(24*R);
m1=l01/2-(l01*l01*l01)/(240*R*R);
m2=l02/2-(l02*l02*l02)/(240*R*R);
printf("b01=%fb02=%fp1=%.3fp2=%.3fm1=%.3fm2=%.3f\n",b01,b02,p1,p2,m1,m2);
printf("曲线综合要素\n");
T1=tan(A*PI/(2*180))*(R+p1)+m1-((p1-p2)/sin(A*PI/180));/*A用弧度*/
T2=tan(A*PI/(2*180))*(R+p2)+m1+((p1-p2)/sin(A*PI/180));
L=((A-b01-b02)*PI/180)*R+l01+l02;
r1=(atan((R+p1)/(T1-m1)))*180/PI;/*把r1从弧度转为°*/
r2=(atan((R+p2)/(T2-m2)))*180/PI;/*把r2从弧度转为°*/
E0=((R+p1)/sin(r1*PI/180))-R;/*r1转为弧度*/
printf("T1=%.3fT2=%.3fL=%.3fr1=%fr2=%fE0=%.3f\n",T1,T2,L,r1,r2,E0);
printf("\n");
/*计算各主点里程*/
printf("计算各主点里程\n");
printf("点距离的计算\n");
D01=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
D02=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
printf("D01=%.3f,D02=%.3f\n",D01,D02);
printf("曲线各主点里程\n");
KZH=K0+(D01-T1);
KHY=KZH+l01;
KQZ=KHY+(PI/2-b01*PI/180-r1*PI/180);
KYH=KZH+L-l01;
KHZ=KZH+L;
K2=(D01-T1)+L+(D02-T2);
printf("KZH=%.3fKHY=%.3fKQZ=%.3fKYH=%.3fKHZ=%.3fK2=%.3f\n",KZH,KHY,KQZ,KYH,KHZ,K2);
/*计算各主点坐标*/
XZH=x0+(KZH-K0)*cos(A01);
YZH=y0+(KZH-K0)*sin(A01);
XHZ=x1+T2*cos(A12);
YHZ=y1+T2*sin(A12);
xHY=l01-(l01*l01*l01)/(40*R*R);/*直角坐标下HY点的坐标*/
yHY=(l01*l01)/(6*R)-(l01*l01*l01*l01)/(336*R*R*R);
printf("直角坐标下HY点的坐标\n");
printf("xHY=%.3fyHY=%.3f\n",xHY,yHY);
printf("\n");
printf("计算各主点坐标\n");
printf("ZH、HZ点坐标\n");
printf("XZH=%.3fYZH=%.3fXHZ=%.3fYHZ=%.3f\n",XZH,YZH,XHZ,YHZ);
if(A>0)
{
XHY=XZH+(sqrt(xHY*xHY+yHY*yHY))*cos(A01+atan(yHY/xHY));
YHY=YZH+(sqrt(xHY*xHY+yHY*yHY))*sin(A01+atan(yHY/xHY));
XYH=XHZ+(sqrt(xHY*xHY+yHY*yHY))*cos(A12+PI-atan(yHY/xHY));
YYH=YHZ+(sqrt(xHY*xHY+yHY*yHY))*sin(A12+PI-atan(yHY/xHY));
}
if(A<0)
{
XHY=XZH+(sqrt(xHY*xHY+yHY*yHY))*cos(A01-atan(yHY/xHY));
YHY=YZH+(sqrt(xHY*xHY+yHY*yHY))*sin(A01-atan(yHY/xHY));
XYH=XHZ+(sqrt(xHY*xHY+yHY*yHY))*cos(A12+PI+atan(yHY/xHY));
YYH=YHZ+(sqrt(xHY*xHY+yHY*yHY))*sin(A12+PI+atan(yHY/xHY));
}
printf("HY、YH点坐标\n");
printf("XHY=%.3fYHY=%.3fXYH=%.3fYYH=%.3f\n",XHY,YHY,XYH,YYH);
printf("\n");
printf("计算逐桩坐标\n");
/*--第一直线段--*/
printf("--第一直线段100米桩--\n");
KZ1=K0;
while(KZ1 { X[i]=x0+(KZ1-K0)*cos(A01); Y[i]=y0+(KZ1-K0)*sin(A01); printf("X[%d]=%.3f,Y[%d]=%.3f",i,X[i],i,Y[i]); if(i%2==0)printf("\n"); KZ1+=100; i++; } printf("\n"); printf("\n"); /*--第一缓和曲线段--*/ printf("--第一缓和曲线段10米桩--\n"); i=1; l10=10.0; while(KH1 { KH1=KZH; x[i]=l10-(l10*l10*l10)/(40*R*R); y[i]=(l10*l10)/(6*R)-(l10*l10*l10*l10)/(336*R*R*R); if(A>0) { X[i]=XZH+(sqrt(x[i]*x[i]+y[i]*y[i]))*cos(A01+atan(y[i]/x[i])); Y[i]=YZH+(sqrt(x[i]*x[i]+y[i]*y[i]))*sin(A01+atan(y[i]/x[i])); } if(A<0) { X[i]=XZH+(sqrt(x[i]*x[i]+y[i]*y[i]))*cos(A01-atan(y[i]/x[i])); Y[i]=YZH+(sqrt(x[i]*x[i]+y[i]*y[i]))*sin(A01-atan(y[i]/x[i])); } printf("X[%d]=%.3f,Y[%d]=%.3f",i,X[i],i,Y[i]); if(i%2==0)printf("\n"); KH1+=l10; l10+=10; i++; } printf("\n"); /*--圆曲线段--*/ printf("--圆曲线段20米桩--\n"); i=1; b1=l01/(2*R); l20=20.0; while(KY { dr[i]=l20/(2*R); if(A>0) { X[i]=XHY+2*R*sin(dr[i])*cos(A01+b1+dr[i]); Y[i]=YHY+2*R*sin(dr[i])*sin(A01+b1+dr[i]); } if(A<0) { X[i]=XHY+2*R*sin(dr[i])*cos(A01-b1-dr[i]); Y[i]=YHY+2*R*sin(dr[i])*sin(A01-b1-dr[i]); } printf("X[%d]=%.3f,Y[%d]=%.3f",i,X[i],i,Y[i]); if(i%2==0)printf("\n"); KY=KHY; KY+=l20; l20+=20; i++; } printf("\n"); /*--第二缓和曲线段--*/ printf("--第二缓和曲线段10米桩--\n"); i=1; l10=10.0; while(KH2 { KH2=KYH; x[i]=l10-(l10*l10*l10)/(40*R*R); y[i]=(l10*l10)/(6*R)-(l10*l10*l10*l10)/(336*R*R*R); if(A>0) { X[i]=XHZ+(sqrt(x[i]*x[i]+y[i]*y[i]))*cos(A12+PI-atan(y[i]/x[i])); Y[i]=YHZ+(sqrt(x[i]*x[i]+y[i]*y[i]))*sin(A12+PI-atan(y[i]/x[i])); } if(A<0) { X[i]=XHZ+(sqrt(x[i]*x[i]+y[i]*y[i]))*cos(A12+PI+atan(y[i]/x[i])); Y[i]=YHZ+(sqrt(x[i]*x[i]+y[i]*y[i]))*sin(A12+PI+atan(y[i]/x[i])); } KH2+=l10; l10+=10; i++; } k=5; i=6; for(j=6;j>0;j--) { printf("X[%d]=%.3f,Y[%d]=%.3f\n",i-k,X[j],i-k--,Y[j]); } printf("\n"); /*--第二直线段--*/ printf("--第二直线段100米桩--\n"); i=1; KZ2=KHZ; while(KZ2 { X[i]=XHZ+(KZ2-KHZ)*cos(A12); Y[i]=YHZ+(KZ2-KHZ)*sin(A12); printf("X[%d]=%.3f,Y[%d]=%.3f",i,X[i],i,Y[i]); if(i%2==0)printf("\n"); KZ2+=100; i++; } printf("\n"); } 程序运行结果: 计算转角 曲线右转 计算曲线要素 缓和曲线常数 b01=2.148594b02=2.148594p1=0.188p2=0.188m1=29.999m2=29.999 曲线综合要素 T1=244.452T2=244.452L=478.960r1=74.997161r2=74.997161E0=28.426 计算各主点里程 点距离的计算 D01=5656.854,D02=4468.131 曲线各主点里程 KZH=5412.403KHY=5472.403KQZ=5472.627KYH=5831.363KHZ=5891.363K2=10115.042 直角坐标下HY点的坐标 xHY=59.992yHY=0.750 计算各主点坐标 ZH、HZ点坐标 XZH=3827.147YZH=3827.147XHZ=4063.245YHZ=4236.129 HY、YH点坐标 XHY=3869.037YHY=3870.097XYH=4046.999YYH=4178.374 计算逐桩坐标 --第一直线段100米桩-- X[1]=0.000,Y[1]=0.000X[2]=70.711,Y[2]=70.711 X[3]=141.421,Y[3]=141.421X[4]=212.132,Y[4]=212.132 X[5]=282.843,Y[5]=282.843X[6]=353.553,Y[6]=353.553 X[7]=424.264,Y[7]=424.264X[8]=494.975,Y[8]=494.975 X[9]=565.685,Y[9]=565.685X[10]=636.396,Y[10]=636.396 X[11]=707.107,Y[11]=707.107X[12]=777.817,Y[12]=777.817 X[13]=848.528,Y[13]=848.528X[14]=919.239,Y[14]=919.239 X[15]=989.949,Y[15]=989.949X[16]=1060.660,Y[16]=1060.660 X[17]=1131.371,Y[17]=1131.371X[18]=1202.082,Y[18]=1202.082 X[19]=1272.792,Y[19]=1272.792X[20]=1343.503,Y[20]=1343.503 X[21]=1414.214,Y[21]=1414.214X[22]=1484.924,Y[22]=1484.924 X[23]=1555.635,Y[23]=1555.635X[24]=1626.346,Y[24]=1626.346 X[25]=1697.056,Y[25]=1697.056X[26]=1767.767,Y[26]=1767.767 X[27]=1838.478,Y[27]=1838.478X[28]=1909.188,Y[28]=1909.188 X[29]=1979.899,Y[29]=1979.899X[30]=2050.610,Y[30]=2050.610 X[31]=2121.320,Y[31]=2121.320X[32]=2192.031,Y[32]=2192.031 X[33]=2262.742,Y[33]=2262.742X[34]=2333.452,Y[34]=2333.452 X[35]=2404.163,Y[35]=2404.163X[36]=2474.874,Y[36]=2474.874 X[37]=2545.584,Y[37]=2545.584X[38]=2616.295,Y[38]=2616.295 X[39]=2687.006,Y[39]=2687.006X[40]=2757.716,Y[40]=2757.716 X[41]=2828.427,Y[41]=2828.427X[42]=2899.138,Y[42]=2899.138 X[43]=2969.848,Y[43]=2969.848X[44]=3040.559,Y[44]=3040.559 X[45]=3111.270,Y[45]=3111.270X[46]=3181.981,Y[46]=3181.981 X[47]=3252.691,Y[47]=3252.691X[48]=3323.402,Y[48]=3323.402 X[49]=3394.113,Y[49]=3394.113X[50]=3464.823,Y[50]=3464.823 X[51]=3535.534,Y[51]=3535.534X[52]=3606.245,Y[52]=3606.245 X[53]=3676.955,Y[53]=3676.955X[54]=3747.666,Y[54]=3747.666 X[55]=3818.377,Y[55]=3818.377 --第一缓和曲线段10米桩-- X[1]=3834.203,Y[1]=3834.232X[2]=3841.230,Y[2]=3841.347 X[3]=3848.226,Y[3]=3848.492X[4]=3855.193,Y[4]=3855.665 X[5]=3862.130,Y[5]=3862.867X[6]=3869.037,Y[6]=3870.097 --圆曲线段20米桩-- X[1]=3882.454,Y[1]=3884.928X[2]=3895.496,Y[2]=3900.090 X[3]=3908.156,Y[3]=3915.573X[4]=3920.424,Y[4]=3931.367 X[5]=3932.294,Y[5]=3947.464X[6]=3943.757,Y[6]=3963.852 X[7]=3954.808,Y[7]=3980.521X[8]=3965.438,Y[8]=3997.461 X[9]=3975.641,Y[9]=4014.662X[10]=3985.411,Y[10]=4032.113 X[11]=3994.742,Y[11]=4049.802X[12]=4003.628,Y[12]=4067.719 X[13]=4012.063,Y[13]=4085.853X[14]=4020.043,Y[14]=4104.192 X[15]=4027.561,Y[15]=4122.724X[16]=4034.614,Y[16]=4141.439 X[17]=4041.197,Y[17]=4160.324 --第二缓和曲线段10米桩-- X[1]=4046.999,Y[1]=4178.374 X[2]=4049.807,Y[2]=4187.970 X[3]=4052.575,Y[3]=4197.579 X[4]=4055.302,Y[4]=4207.200 X[5]=4057.990,Y[5]=4216.831 X[6]=4060.637,Y[6]=4226.474 --第二直线段100米桩-- X[1]=4063.245,Y[1]=4236.129X[2]=4089.117,Y[2]=4332.724 X[3]=4114.989,Y[3]=4429.319X[4]=4140.861,Y[4]=4525.914 X[5]=4166.733,Y[5]=4622.509X[6]=4192.605,Y[6]=4719.105 X[7]=4218.478,Y[7]=4815.700X[8]=4244.350,Y[8]=4912.295 X[9]=4270.222,Y[9]=5008.890X[10]=4296.094,Y[10]=5105.485 X[11]=4321.966,Y[11]=5202.081X[12]=4347.838,Y[12]=5298.676 X[13]=4373.710,Y[13]=5395.271X[14]=4399.582,Y[14]=5491.866 X[15]=4425.454,Y[15]=5588.461X[16]=4451.327,Y[16]=5685.057 X[17]=4477.199,Y[17]=5781.652X[18]=4503.071,Y[18]=5878.247 X[19]=4528.943,Y[19]=5974.842X[20]=4554.815,Y[20]=6071.437 X[21]=4580.687,Y[21]=6168.033X[22]=4606.559,Y[22]=6264.628 X[23]=4632.431,Y[23]=6361.223X[24]=4658.304,Y[24]=6457.818 X[25]=4684.176,Y[25]=6554.413X[26]=4710.048,Y[26]=6651.009 X[27]=4735.920,Y[27]=6747.604X[28]=4761.792,Y[28]=6844.199 X[29]=4787.664,Y[29]=6940.794X[30]=4813.536,Y[30]=7037.389 X[31]=4839.408,Y[31]=7133.985X[32]=4865.280,Y[32]=7230.580 X[33]=4891.153,Y[33]=7327.175X[34]=4917.025,Y[34]=7423.770 X[35]=4942.897,Y[35]=7520.366X[36]=4968.769,Y[36]=7616.961 X[37]=4994.641,Y[37]=7713.556X[38]=5020.513,Y[38]=7810.151 X[39]=5046.385,Y[39]=7906.746X[40]=5072.257,Y[40]=8003.342 X[41]=5098.129,Y[41]=8099.937X[42]=5124.002,Y[42]=8196.532 X[43]=5149.874,Y[43]=8293.127 Pressanykeytocontinue \作业一 编写一个程序,根据离散点数字地形数据,利用移动拟合法计算给定点的地面高程。 原始数据: X=102109105103108105115118116113,Y=110113115103105108104108113116,Z=15181917211520151722 #ifndefCONST_H #defineCONST_H #defineUSENUM
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机辅助设计
![提示](https://static.bdocx.com/images/bang_tan.gif)