Adding and modify many useful function

in their header file:
-blh2enu.h
-xyz2blh.h
-rahcal.h
-deg2dms.h
-degRrad.h
This commit is contained in:
KenanZhu111 committed 2024-09-21 11:38:30 +08:00
1 parent 22cc906c00
commit c44c1df50f
10 files changed
+57651 -57503

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
#ifndef _DEG2DMS_H_
#define _DEG2DMS_H_
#include<stdlib.h>
#include<math.h>
typedef struct
{
double D;
double M;
double S;
}deg2dms, *pdeg2dms;
/* -------------------------------------------------------------------------- */
/// @brief 将十进制的度数转换为度分秒形式
/// @param deg2dms 结构体传递参数
/// @param D 要转换度数
/// @return 返回自定义结构体包含度,分,秒成员
/* -------------------------------------------------------------------------- */
pdeg2dms DEG2DMS(pdeg2dms deg2dms,
double D)
{
deg2dms = (pdeg2dms)malloc(sizeof(pdeg2dms));
int sig = D / fabs(D);//符号判断
deg2dms->D = (int)(D);//转换为度分秒
deg2dms->M = (int)((D - deg2dms->D) * 60);//分秒去除符号格式
deg2dms->S = (int)(((D - deg2dms->D) * 60 - deg2dms->M) * 60);
deg2dms->M = deg2dms->M * sig;
deg2dms->S = deg2dms->S * sig;
return deg2dms;
}
#endif