- UID
- 179985
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-10-1
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
#include "stdio.h"
#include "string.h"
#include "math.h"
#include "mem.h"
#define k 0.11
#define bj 6361730
main()
{
FILE *f1,*m1,*f5;
char a5[10],a33[10],b1[10],a3[10],a[10];
char filename[15];
int l,l1,l2,l3,i,i1;
int l4,l5;
float a1,a2,a4,a6;
double f2,f3,jj1,jj2,jj3,jj4,jj5;
double jd1,jd2,jd3,jd4,jd5,t;
double x,y,t1,t2;
double f4[200],gc;
double pt ,pp,s1,s2;
double yqg;
double zx[300],zy[300],zz[300];
char *sz[200];
char f[200][10];
char *a43="1";
i=0;l5=0;
printf("input the filename:");
gets(filename);
if ((f1=fopen(filename,"r"))==NULL)
{
puts("cannot open file");
goto end;
}
strcat(filename,".XY1");
if ((f5=fopen(filename,"w"))==NULL)
{
puts("cannot open file");
}
fclose(f5);
if ((m1=fopen("s2.txt","w"))==NULL)
{
puts("cannot open file");
}
if (!feof(f1))
{
fscanf(f1,"%s%f%f%s%f%s",&a,&a1,&a2,&a3,&a4,&a5);
}
while (!feof(f1))
{
l=strcmp(a43,a5);
if (l==0)
{
fprintf(m1,"%s%s%10.4f%s%10.4f%s%s%s%10.4f%s%s\n",a," ",a1," ",a2," ",a3," ",a4," ",a5);
kz1(a,&jj1,&jj2,&jj3,&jj4,&jj5);
if (jj5==-8888)
{
int l5=50;
for (i1=1 ;i1<=i;i1++)
{
l4=strcmp(a,sz[i1]);
if (l4==0)
{
jj3=zx[i1];
jj4=zy[i1];
jj5=zz[i1];
i1=i+1;
l5=100;
}
}
if (l5==50)
{
printf("cannot find control point:");
printf("%s\n",a);
goto end;
}
}
if (l5==0)
{
printf("%10.4lf%s%10.7lf\n",jj1," ",jj2);
l5=1;
}
kz1(a3,&jd1,&jd2,&jd3,&jd4,&jd5);
if (jd5==-8888)
{
int l5=50;
for (i1=1 ;i1<=i;i1++)
{
l4=strcmp(a3,sz[i1]);
if (l4==0)
{
jd3=zx[i1];
jd4=zy[i1];
jd5=zz[i1];
i1=i+1;
l5=100;
}
}
if (l5==50)
{
printf("cannot find control point:");
printf("%s\n",a3);
goto end;
}
}
yqg=a2;
fwj(&jj3,&jj4,&jd3,&jd4,&t);
fscanf(f1,"%s%f%f%s%f%s",&a,&a1,&a2,&a3,&a4,&a5);
pp=atof(a);
pt=a1;
fprintf(m1,"%s%s%10.4f%s%10.4f%s%s%s%10.4f%s%s\n",a," ",a1," ",a2," ",a3," ",a4," ",a5);
}
else
{
a6=atof(a3);
jdhs(a1,&t1);
t1=t+t1/180*3.141592654;
if (t1>=2*3.141592654)
{t1=t1-2*3.141592654;}
jdhs(a2,&t2);
t2=(90-t2)/180*3.141592654;
s1=a6*(1.000279-0.0000002904*pp/(1+.0037*pt))*(1+jj2)+jj1;
gc=s1*sin(t2)+s1*s1*(cos(t2)*cos(t2))*(1-k)/2/bj+yqg-a4+jj5;
s1=s1*cos(t2)-(((2-k)/4)/bj)*s1*s1*sin(2*t2);
x=s1*cos(t1)+jj3;
y=jj4+s1*sin(t1);
if (a4<0)
{gc=-15000.0;}
if ((f5=fopen(filename,"a"))==NULL)
{
puts("cannot open file");
}
fprintf(f5,"%6s%s%15.3f%s%15.3f%s%15.3f%s%s%s\n",a," ",x," ",y,"",gc," ",a5);
fclose(f5);
if (strlen(a5)>2)
{
char a9[10]="1";
strupr(a5);
memmove(a9,a5,2);
l3=strcmp(a9,"2Y");
if (l3==0)
{
i++;
memmove(f,a5,strlen(a5)+1);
sz=f+2;
zx=x;
zy=y;
zz=gc;
}
}
fprintf(m1,"%s%s%10.4f%s%10.4f%s%10.4f%s%10.4f%s%s\n",a," ",a1," ",a2," ",a6," ",a4," ",a5);
}
fscanf(f1,"%s%f%f%s%f%s",&a,&a1,&a2,&a3,&a4,&a5);
}
end: fclose(f1);
fclose(m1);
}
kz1(dh,j11,j12,j13,j14,j15)
double *j11,*j12,*j13,*j14,*j15;
char dh[10];
{
int k1,k2;
FILE *m3,*m4;
double j1,j2,j3,j4,j5;
char z2[20],z3[10],z4[10];
k2=100;
if ((m3=fopen("sbjs.dat","r"))==NULL)
{
puts("cannot open file");
}
fscanf(m3,"%lf%lf%s",&j1,&j2,&z2);
*j11=j1;
*j12=j2;
fclose(m3);
if ((m4=fopen(z2,"r"))==NULL)
{
puts("cannot open file");
}
fscanf(m4,"%s%s%lf%lf%lf",&z3,&z4,&j3,&j4,&j5);
while(!feof(m4))
{
k1=strcmp(dh,z3);
if (k1!=0)
{
fscanf(m4,"%s%s%lf%lf%lf",&z3,&z4,&j3,&j4,&j5);
}
else
{
*j13=j3;
*j14=j4;
*j15=j5;
k2=101;
fseek(m4,0,SEEK_END);
z3[0]='';
}
}
if (k2==100)
{
*j15=-8888;
}
fclose(m4);
}
fwj(x1,y1,x2,y2,t1)
double *x1,*y1,*x2,*y2,*t1;
{
double t;
if ((*x2-*x1)==0)
{
t=3.141592654/2;
}
else
{
t=atan ((*y2-*y1)/(*x2-*x1));
if (t<0)
{
t=t+3.141592654;
}
}
if ((*y2-*y1)<0)
{t=t+3.141592654;}
*t1=t;
}
jdhs(tb,tc)
double tb,*tc;
{
double t1,t2,t3,t4,t5;
t5=tb;
if (t5<0)
{t5=0-tb;}
t5=0.000001+t5;
t1=modf(t5,&t2);
t3=modf((t1*100.00+0.000000000001),&t4);
if (tb >=0)
{
tb=t2+t4/60.0+t3/36;
}
else
{
tb=0-(t2+t4/60.0+t3/36);
}
*tc=tb;
} |
|