C language to calculate the radius of the meridian circle and the unitary circle at a certain latitude

C language to calculate the radius of the meridian circle and the unitary circle at a certain latitude

1. Enter the latitude and calculate the radius of the meridian circle and the unitary circle.

Enter 1 and choose the international 75 ellipsoid. Enter the latitude of 12°34'56″, and the calculated radius of the meridian circle is 6338193.296 meters, and the radius of the unitary circle is 6379063.053 meters. The
Insert picture description here
input azimuth angle is 21°43′6″, and the radius of curvature at this point is 6343412.766 meters.
Insert picture description here

2. Part of the source code

#include<stdio.h>
#include<math.h>
#define guoji75_a 6378140.00
#define guoji75_b 6356755.2881575287
#define PI 3.1415926535897932
#define keshi_a 6378245.0
#define keshi_b 6356863.0187730473

double zwqqlbj (int w[],double a,double b)
{
	double B,M,e1;
	e1 = (sqrt((a * a) - (b * b))) / a;
	B = (w[0] + (w[1] / 60) + (w[2] / 3600)) * PI /180;
	M=...... 
	return M;
}

double myqqlbj(int w[],double a,double b)
{
	double B,N,e1;
	e1 = (sqrt((a * a) - (b * b))) / a;
	B = (w[0] + (w[1] / 60) + (w[2] / 3600)) * PI /180;
	N = ...
	return N;
}
double ryfjhqlbj(int w[],double M,double N)
{
	double A,R;
	A = (w[0] + (w[1] / 60) + (w[2] / 3600)) * PI/ 180;
	R = ...
}
double zwxhc(int w[],int tuoqiu)
{
	double X,B;
	B = (w[0] + (w[1] / 60) + (w[2] / 3600)) * PI /180;
	if(tuoqiu==1)
		X=111133.005*B*180/PI-16038.528*sin(2*B)+16.833*sin(4*B)-0.022*sin(6*B);
	if(tuoqiu==2)
		X=111134.861*B*180/PI-16036.48*sin(2*B)+16.828*sin(4*B)-0.022*sin(6*B);
	return X;
}

main()
{
	double a, e1,e2,M,N,R,_a,_b,A,B,X,P,x1,x2;
	int weidu[3],fangweijiao[3],L1[3],L2[3],B1[3],B2[3],weidu1[3],weidu2[3];
	int i,fg;
	printf("请输入计算所用的椭球(国际75椭球请输1,克氏椭球请输2,回车结束。):\n\n");
	scanf_s("%d",&fg);
	if(fg==1)
	{
		_a=guoji75_a;
		_b=guoji75_b;
	}
	else if(fg==2)
	{
		_a=keshi_a;
		_b=keshi_b;
	}

	printf("请输入某点的纬度(度分秒之间用空格隔开,按回车结束):\n\n");
	for(i=0;i<3;i++)
		scanf_s("%d",&weidu[i]);

	M = zwqqlbj(weidu,_a,_b);
	printf("纬度为%d°%d′%d″处子午圈曲率半径M=%f米\n\n",weidu[0],weidu[1],weidu[2],M);

	N = myqqlbj(weidu,_a,_b);
	printf("纬度为%d°%d′%d″处卯酉圈曲率半径N=%f米\n\n",weidu[0],weidu[1],weidu[2],N);
	
	X=zwxhc(weidu,fg);
	printf("从赤道到纬度为%d°%d′%d″的子午线弧长为%f米\n\n",weidu[0],weidu[1],weidu[2],X);

	printf("请输入一个方位角(度分秒之间用空格隔开,按回车结束):\n\n");
	for(i=0;i<3;i++)
		scanf_s("%d",&fangweijiao[i]);
	
	R = ryfjhqlbj(fangweijiao,M,N);
	printf("纬度%d°%d′%d″处方位角为%d°%d′%d″方向的曲率半径为:%f米\n\n",weidu[0],weidu[1],weidu[2],fangweijiao[0],fangweijiao[1],fangweijiao[2],R);
}

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/114801219