资源简介

c语言导线网间接平差 原始数据保存在文件中,处理成果导入txt文件,方便学测绘同学作业用

资源截图

代码片段和文件信息


#include
#include
#include

#define M 100
#define N 100
#define JS 24
#define BS 18
#define DS 13
#define p 206264.80624709635515647335733
#define PI 3.14159265358979323846264

double B[M][M]l[M]flag[M][M]J_fangweijiao[M][M]J_bianchang[M][M]J_x[M]J_y[M]fg[M]J_Azi[M][M];
double BT[M][M]P[M][M]BTP[M][M]BTPB[M][M]BTPL[M]BTPBN[M][M]x[M]X[M]Y[M]v[M];
double danweiquanzhongwuchax_zhongwucha[M]y_zhongwucha[M]d_zhongwucha[M]x26[M];

struct
{
int targetK;
int dingdianJ;
int targetH;
double size;
}zhuanjiao[M];

struct
{
int qidian;
int zhongdian;
double size;
}bian[M];

//将弧度转成角度输出
void hudu_jiaodu(double aint *duint *fendouble *miao)
{
double aa;
aa=a*180/PI;
*du=(int)aa;
*fen=(int)((aa-*du)*60);
*miao=(aa-*du-(double)*fen/60)*3600;
}

//将角度转化成弧度
double jiaodu_hudu(double a)
{
double dufenmiaohu;
du=(int)(a);
fen=(int)((a-du)*100);
miao=(a-du-fen/100)*10000;
hu=(du+fen/60+miao/3600)*PI/180;
// printf(“%lf\n“hu);
return hu;
}

//读取数据
void shujuduqu()
{
int iabcno;
double ccd;
FILE *fp1;
fp1=fopen(“导线网原始数据.txt““r“);
if (fp1==NULL)
{
printf(“打开文件失败!\n“);
exit(0);
}

//读取夹角(角度测量值)
for(i=1;i<=JS;i++)
{
fscanf(fp1“%d%d%d%d%lf“&no&a&b&c&d);
zhuanjiao[i].targetK=a;
zhuanjiao[i].dingdianJ=b;
zhuanjiao[i].targetH=c;
zhuanjiao[i].size=jiaodu_hudu(d);
}

//读取边长测量值
for(i=1;i<=BS;i++)
{
fscanf(fp1“%d%d%d%lf“&no&a&b&cc);
bian[i].qidian=a;
bian[i].zhongdian=b;
bian[i].size=cc;
}

//读取起始方位角
for (i=1;i<2;i++)
{
fscanf(fp1“%d%d%lf“&a&b&cc);
J_fangweijiao[a][b]=jiaodu_hudu(cc);
J_Azi[a][b]=jiaodu_hudu(cc);
cc=J_fangweijiao[a][b]-PI;
while(cc<0)
cc+=2*PI;
while(cc>=2*PI)
cc-=2*PI;
J_fangweijiao[b][a]=cc;
J_Azi[b][a]=cc;
flag[a][b]=flag[b][a]=1;
}

//读取起始坐标
for(i=1;i<2;i++)
{
fscanf(fp1“%d%lf%lf“&a&d&cc);
J_x[a]=d;
J_y[a]=cc;
fg[a]=1;
}
fclose(fp1);
}

//计算近似坐标
void cal_jinsizuobiao()
{
// 计算方位角用于计算近似坐标
int iKJH;
for (i=1;i<=JS;i++)
{
K=zhuanjiao[i].targetK;
        J=zhuanjiao[i].dingdianJ;
        H=zhuanjiao[i].targetH;
if(flag[J][H]&&!flag[J][K])
{
J_fangweijiao[J][K]=J_fangweijiao[J][H]+zhuanjiao[i].size;
while(J_fangweijiao[J][K]<0)
J_fangweijiao[J][K]+=2*PI;
while(J_fangweijiao[J][K]>=2*PI)
J_fangweijiao[J][K]-=2*PI;
J_fangweijiao[K][J]=J_fangweijiao[J][K]-PI;
while(J_fangweijiao[K][J]<0)
J_fangweijiao[K][J]+=2*PI;
while(J_fangweijiao[K][J]>=2*PI)
J_fangweijiao[K][J]-=2*PI;
flag[J][K]=flag[K][J]=1;
}
if(!flag[J][H]&&flag[J][K])
{
J_fangweijiao[J][H]=J_fangweijiao[J][K]-zhuanjiao[i].size;
while(J_fangweijiao[J][H]<0)
J_fangweijiao[J][H]+=2*PI;
while(J_fangweijiao[J][H]>=2*PI)
J_fangweijiao[J][H]-=2*PI;
J_fangweijiao[H][J]=J_fangweijiao[J][H]-PI;
while(J_fangweijiao[H][J]<0)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-27 21:00  导线网\
     目录           0  2013-04-27 21:00  导线网\Debug\
     文件       33792  2013-01-06 15:47  导线网\Debug\vc60.idb
     文件       45056  2013-01-06 15:47  导线网\Debug\vc60.pdb
     文件      241755  2013-01-06 15:47  导线网\Debug\导线网.exe
     文件      241084  2013-01-06 15:47  导线网\Debug\导线网.ilk
     文件       48328  2013-01-06 15:47  导线网\Debug\导线网.obj
     文件      190604  2013-01-06 15:47  导线网\Debug\导线网.pch
     文件      427008  2013-01-06 15:47  导线网\Debug\导线网.pdb
     文件       15695  2013-01-06 15:15  导线网\导线网.c
     文件        3401  2013-01-06 15:47  导线网\导线网.dsp
     文件         520  2013-01-06 15:47  导线网\导线网.dsw
     文件       33792  2013-01-06 15:47  导线网\导线网.ncb
     文件       48640  2013-01-06 15:47  导线网\导线网.opt
     文件         750  2013-01-06 15:47  导线网\导线网.plg
     文件         774  2012-12-31 10:48  导线网\导线网原始数据.txt
     文件       48703  2013-01-06 15:47  导线网\导线网平差成果.txt

评论

共有 条评论