44 lines
864 B
C
44 lines
864 B
C
|
#pragma once
|
||
|
#ifndef _LOCATION_TOOL_H_
|
||
|
#define _LOCATION_TOOL_H_
|
||
|
|
||
|
#include <stddef.h>
|
||
|
|
||
|
#ifndef PI
|
||
|
//#define PI 3.14159265358979323846
|
||
|
#endif // !PI
|
||
|
|
||
|
#ifndef EARTH_RADIUS
|
||
|
#define EARTH_RADIUS 6371008.8
|
||
|
#endif
|
||
|
|
||
|
typedef struct DoublePair {
|
||
|
double x;
|
||
|
double y;
|
||
|
} DoublePair;
|
||
|
typedef DoublePair PlaneCoordinate;
|
||
|
|
||
|
typedef struct LatLng{
|
||
|
double lat;
|
||
|
double lon;
|
||
|
} LatLng;
|
||
|
|
||
|
typedef struct DoublePairList{
|
||
|
double *x;
|
||
|
double *y;
|
||
|
size_t length;
|
||
|
} DoublePairList;
|
||
|
typedef struct LocationList{
|
||
|
double *lat;
|
||
|
double *lon;
|
||
|
size_t length;
|
||
|
} LocationList;
|
||
|
|
||
|
LatLng ProjPointOfLatLng(LatLng point, LatLng linePointA, LatLng linePointB);
|
||
|
DoublePair ProjPoint(DoublePair point, DoublePair linePointA, DoublePair linePointB);
|
||
|
|
||
|
//PlaneCoordinate WGS84_XYZ(const LatLng lla);
|
||
|
double CalculateDistance(LatLng pointA, LatLng pointB);
|
||
|
|
||
|
#endif // !_LOCATION_TOOL_H_
|