🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
GeoCoordinate.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "LatLonAlt.hpp"
25#include "AstMath/Vector.hpp"
26#include "AstUtil/Math.hpp"
27#include <cmath>
28
29AST_NAMESPACE_BEGIN
30
31class GeocentricPoint;
32class GeodeticPoint;
33
34
35
38{
39public:
40 GeoCoordinate() noexcept {};
41
43 constexpr GeoCoordinate(double lat, double lon, double alt = 0.0) noexcept
44 : latLonAlt_{lat, lon, alt} {}
45
47 constexpr explicit GeoCoordinate(const LatLonAlt& latLonAlt) noexcept
48 : latLonAlt_{latLonAlt} {}
49
50public: // get and set methods
51
53 constexpr const LatLonAlt& latLonAlt() const noexcept { return latLonAlt_; }
55 void setLatLonAlt(const LatLonAlt& latLonAlt) noexcept{ latLonAlt_ = latLonAlt; }
56
58 double latitude() const { return latLonAlt_.latitude(); }
60 double longitude() const { return latLonAlt_.longitude(); }
62 double altitude() const { return latLonAlt_.altitude(); }
64 double& latitude() { return latLonAlt_.latitude(); }
66 double& longitude() { return latLonAlt_.longitude(); }
68 double& altitude() { return latLonAlt_.altitude(); }
70 void setLatitude(double lat) { latLonAlt_.setLatitude(lat); }
72 void setLongitude(double lon) { latLonAlt_.setLongitude(lon); }
74 void setAltitude(double alt) { latLonAlt_.setAltitude(alt); }
75
76public: // as methods
77
82public:
84 Vector3d getZenith() const;
86 Vector3d getNadir() const;
88 Vector3d getEast() const;
90 Vector3d getWest() const;
92 Vector3d getNorth() const;
94 Vector3d getSouth() const;
95
96public:
98};
99
100inline Vector3d GeoCoordinate::getZenith() const
101{
102 double lat = latitude();
103 double lon = longitude();
104 double sLat, cLat, sLon, cLon;
105 sincos(lat, &sLat, &cLat);
106 sincos(lon, &sLon, &cLon);
107 return {cLon * cLat, sLon * cLat, sLat};
108}
109
110inline Vector3d GeoCoordinate::getNadir() const
111{
112 return -getZenith();
113}
114
115inline Vector3d GeoCoordinate::getEast() const
116{
117 double sLon, cLon;
118 sincos(longitude(), &sLon, &cLon);
119 return {-sLon, cLon, 0};
120}
121
122inline Vector3d GeoCoordinate::getWest() const
123{
124 return -getEast();
125}
126
127inline Vector3d GeoCoordinate::getNorth() const
128{
129 double lat = latitude();
130 double lon = longitude();
131 double sLat, cLat, sLon, cLon;
132 sincos(lat, &sLat, &cLat);
133 sincos(lon, &sLon, &cLon);
134 return {-cLon * sLat, -sLon * sLat, cLat};
135}
136
137inline Vector3d GeoCoordinate::getSouth() const
138{
139 return -getNorth();
140}
141
148AST_CORE_CAPI void aSurfaceCentricToDetic(const GeocentricPoint& centric, double flatFact, GeodeticPoint& detic);
149
150
157AST_CORE_CAPI void aSurfaceDeticToCentric(const GeodeticPoint& detic, double flatFact, GeocentricPoint& centric);
158
159
160
166AST_CORE_CAPI double aSurfaceCentricToDeticLat(double centricLat, double flatFact);
167
168
174A_ALWAYS_INLINE double aSurfaceCentricToDetic(double centricLat, double flatFact)
175{
176 return aSurfaceCentricToDeticLat(centricLat, flatFact);
177}
178
184AST_CORE_CAPI double aSurfaceDeticToCentricLat(double deticLat, double flatFact);
185
186
192A_ALWAYS_INLINE double aSurfaceDeticToCentric(double deticLat, double flatFact)
193{
194 return aSurfaceDeticToCentricLat(deticLat, flatFact);
195}
196
197
198AST_NAMESPACE_END
地理坐标
定义 GeoCoordinate.hpp:38
GeodeticPoint & asGeodeticPoint()
作为大地坐标使用
定义 GeoCoordinate.hpp:81
double & altitude()
设置高度
定义 GeoCoordinate.hpp:68
GeocentricPoint & asGeocentricPoint()
作为地心坐标使用
定义 GeoCoordinate.hpp:79
void setLatLonAlt(const LatLonAlt &latLonAlt) noexcept
设置纬度、经度、高度坐标
定义 GeoCoordinate.hpp:55
constexpr const LatLonAlt & latLonAlt() const noexcept
获取纬度、经度、高度坐标
定义 GeoCoordinate.hpp:53
double longitude() const
获取经度
定义 GeoCoordinate.hpp:60
constexpr GeoCoordinate(const LatLonAlt &latLonAlt) noexcept
从纬度、经度、高度坐标构造
定义 GeoCoordinate.hpp:47
double & longitude()
设置经度
定义 GeoCoordinate.hpp:66
void setLongitude(double lon)
设置经度
定义 GeoCoordinate.hpp:72
double latitude() const
获取纬度
定义 GeoCoordinate.hpp:58
double & latitude()
设置纬度
定义 GeoCoordinate.hpp:64
void setLatitude(double lat)
设置纬度
定义 GeoCoordinate.hpp:70
double altitude() const
获取高度
定义 GeoCoordinate.hpp:62
LatLonAlt latLonAlt_
纬度、经度、高度坐标
定义 GeoCoordinate.hpp:97
constexpr GeoCoordinate(double lat, double lon, double alt=0.0) noexcept
从纬度、经度、高度坐标构造
定义 GeoCoordinate.hpp:43
void setAltitude(double alt)
设置高度
定义 GeoCoordinate.hpp:74
地心坐标
定义 GeocentricPoint.hpp:33
大地坐标
定义 GeodeticPoint.hpp:33
纬度、经度、高度坐标
定义 LatLonAlt.hpp:30
A_ALWAYS_INLINE void sincos(double x, double *psin, double *pcos)
计算 sin(x) 和 cos(x) 值
定义 Math.hpp:47
void aSurfaceDeticToCentric(const GeodeticPoint &detic, double flatFact, GeocentricPoint &centric)
将天体表面的大地坐标转换为地心坐标
定义 GeoCoordinate.cpp:37
double aSurfaceCentricToDeticLat(double centric, double flatFact)
将天体表面的地心纬度转换为大地纬度
定义 GeoCoordinate.cpp:44
void aSurfaceCentricToDetic(const GeocentricPoint &centric, double flatFact, GeodeticPoint &detic)
将天体表面的地心坐标转换为大地坐标
定义 GeoCoordinate.cpp:30
double aSurfaceDeticToCentricLat(double detic, double flatFact)
将天体表面的大地纬度转换为地心纬度
定义 GeoCoordinate.cpp:51