🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
CelestialBody.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/Object.hpp"
25#include "AstCore/GravityField.hpp"
26#include "AstCore/JplDe.hpp"
27#include "AstCore/BodyEphemeris.hpp"
28#include "AstCore/BodyOrientation.hpp"
29#include "AstCore/AxesBodyInertial.hpp"
30#include "AstCore/AxesBodyFixed.hpp"
31#include "AstCore/AxesBodyMOD.hpp"
32#include "AstCore/AxesBodyTOD.hpp"
33#include "AstCore/Point.hpp"
34#include "AstCore/Frame.hpp"
35#include "AstCore/AxesAPI.hpp"
36#include "AstCore/BodyShape.hpp"
37#include "AstUtil/SharedPtr.hpp"
38#include "AstUtil/ScopedPtr.hpp"
39
40AST_NAMESPACE_BEGIN
41
47class CelestialBody;
48using Body = CelestialBody;
49
51class AST_CORE_API CelestialBody : public Point
52{
53 AST_OBJECT(CelestialBody)
54public:
56 CelestialBody(SolarSystem* solarSystem);
57 CelestialBody(StringView name, SolarSystem* solarSystem = nullptr);
59
61 const std::string& getName() const override { return name_; }
62 void setName(StringView name) { name_ = std::string(name); }
63
65 int getJplSpiceId() const { return jplSpiceId_; }
66 void setJplSpiceId(int id) { jplSpiceId_ = id; }
67
69 int getJplIndex() const { return jplIndex_; }
70 void setJplIndex(int index);
71
73 std::string getDirpath() const;
74
76 SolarSystem* getSolarSystem() const;
77
79 CelestialBody* getParent() const { return parent_.get(); }
80public:
81
83 const std::string& getGravityModel() const{ return gravityField_.getModelName(); }
84
88 errc_t load(StringView filepath);
89
91 double getRadius() const { return radius_; }
92
94 double getGM() const { return gm_; }
95
97 double getSystemGM() const { return systemGM_; }
98
100 errc_t setGravityModel(StringView model);
101
103 double getJ2() const { return getJn(2); }
104
106 double getJ3() const { return getJn(3); }
107
109 double getJ4() const { return getJn(4); }
110
112 double getJ5() const { return getJn(5); }
113
115 double getJ6() const { return getJn(6); }
116
118 bool isEarth() const { return jplIndex_ == JplDe::eEarth; }
119
124 errc_t getPosICRF(const TimePoint& tp, Vector3d& pos) const;
125
126
132 errc_t getPosVelICRF(const TimePoint& tp, Vector3d& pos, Vector3d& vel) const;
133
134public: // 从Point继承重写的函数
135
136 Frame* getFrame() const final;
137 errc_t getPos(const TimePoint& tp, Vector3d& pos) const final;
138 errc_t getPosVel(const TimePoint& tp, Vector3d& pos, Vector3d& vel) const final;
139
140PROPERTIES: // 天体的形状、重力场、星历、姿态
141
143 BodyShape* getShape() const { return shape_.get(); }
144
146 const GravityField& getGravityField() const { return gravityField_; }
147
149 BodyEphemeris* getEphemeris() const { return ephemeris_.get(); }
150
152 BodyOrientation* getOrientation() const { return orientation_.get(); }
153
154public:
155
157 Point* getPointCenter() const { return const_cast<CelestialBody*>(this); }
158
160 Axes* getAxesInertial() const { return axesInertial_.get(); }
161
163 Axes* getAxesFixed() const { return axesFixed_.get(); }
164
166 Axes* getAxesMOD() const { return axesMOD_.get(); }
167
169 Axes* getAxesTOD() const { return axesTOD_.get(); }
170
175 Axes* getAxes(StringView name) const;
176
177public:
183 HAxes makeEpochAxes(Axes* sourceAxes, const TimePoint& tp, Axes* reference) const{return aMakeEpochAxes(sourceAxes, tp, reference);}
184
190 HAxes makeEpochAxes(Axes* sourceAxes, EventTime* time, Axes* reference) const{return aMakeEpochAxes(sourceAxes, time, reference);}
191
192
198 HFrame makeEpochFrame(Axes* sourceAxes, const TimePoint& tp, Axes* reference) const;
199
205 HFrame makeEpochFrame(Axes* sourceAxes, EventTime* time, Axes* reference) const;
206
208 HAxes makeAxesMOE(const TimePoint& tp) const;
209
211 HAxes makeAxesMOE(EventTime* time) const;
212
214 HAxes makeAxesTOE(const TimePoint& tp) const;
215
217 HAxes makeAxesTOE(EventTime* time) const;
218
220 HFrame makeFrameMOE(const TimePoint& tp) const;
221
223 HFrame makeFrameMOE(EventTime* time) const;
224
226 HFrame makeFrameTOE(const TimePoint& tp) const;
227
229 HFrame makeFrameTOE(EventTime* time) const;
230
231public:
234 HFrame makeFrame(Axes* axes) const;
235
237 HFrame makeFrameInertial() const;
238
240 HFrame makeFrameFixed() const;
241
243 HFrame makeFrameMOD() const;
244
246 HFrame makeFrameTOD() const;
247
249 HFrame makeFrameJ2000() const;
250
252 HFrame makeFrameICRF() const;
253protected:
254
255 Axes* getEpochAxesReference() const;
256protected:
258 double getJn(int n) const { return gravityField_.getJn(n); }
259
261 errc_t loadGravityModel(StringView model);
262protected:
263 friend class SolarSystem;
264
266 errc_t loadAstroDefinition(BKVParser& parser);
267
269 errc_t loadSpinData(BKVParser& parser);
270
272 errc_t loadEphemerisData(BKVParser& parser);
273
275 errc_t loadEarth(BKVParser& parser);
276
278 errc_t loadMoon(BKVParser& parser);
279
281 errc_t loadMeanEarthDefinition(BKVParser& parser);
282
283 A_DISABLE_COPY(CelestialBody)
284protected:
287 std::string name_;
288 double gm_{0.0};
289 double systemGM_{0.0};
290 double radius_{0.0};
291 int jplSpiceId_{-1};
292 int jplIndex_{-1};
297
302
306};
307
308
309
310
314{
315 eSolarSystemBarycenter = 0,
316 eMercuryBarycenter = 1,
317 eVenusBarycenter = 2,
318 eEarthBarycenter = 3,
319 eMarsBarycenter = 4,
320 eJupiterBarycenter = 5,
321 eSaturnBarycenter = 6,
322 eUranusBarycenter = 7,
323 eNeptuneBarycenter = 8,
324 ePlutoBarycenter = 9,
325 eSun = 10,
326
327 eMercury = 199,
328
329 eVenus = 299,
330
331 eEarth = 399,
332 eMoon = 301,
333
334 eMars = 499,
335 ePhobos = 401,
336 eDeimos = 402,
337
338
339 eJupiter = 599,
340 eIo = 501,
341 eEuropa = 502,
342 eGanymede = 503,
343 eCallisto = 504,
344 eAmalthea = 505,
345 eHimalia = 506,
346 eElara = 507,
347 ePasiphae = 508,
348 eSinope = 509,
349 eLysithea = 510,
350 eCarme = 511,
351 eAnanke = 512,
352 eLeda = 513,
353 eThebe = 514,
354 eAdrastea = 515,
355 eMetis = 516,
356
357 eSaturn = 699,
358 eMimas = 601,
359 eEnceladus = 602,
360 eTethys = 603,
361 eDione = 604,
362 eRhea = 605,
363 eTitan = 606,
364 eHyperion = 607,
365 eIapetus = 608,
366 ePhoebe = 609,
367 eJanus = 610,
368 eEpimetheus = 611,
369 eHelene = 612,
370 eTelesto = 613,
371 eCalypso = 614,
372 eAtlas = 615,
373 ePrometheus = 616,
374 ePandora = 617,
375 ePan = 618,
376 eMethone = 632,
377 ePallene = 633,
378 ePolydeuces = 634,
379 eDaphnis = 635,
380 eAnthe = 649,
381 eAegaeon = 653,
382
383
384 eUranus = 799,
385 eAriel = 701,
386 eUmbriel = 702,
387 eTitania = 703,
388 eOberon = 704,
389 eMiranda = 705,
390 eCordelia = 706,
391 eOphelia = 707,
392 eBianca = 708,
393 eCressida = 709,
394 eDesdemona = 710,
395 eJuliet = 711,
396 ePortia = 712,
397 eRosalind = 713,
398 eBelinda = 714,
399 ePuck = 715,
400
401
402 eNeptune = 899,
403 eTriton = 801,
404 eNereid = 802,
405 eNaiad = 803,
406 eThalassa = 804,
407 eDespina = 805,
408 eGalatea = 806,
409 eLarissa = 807,
410 eProteus = 808,
411
412 ePluto = 999,
413 eCharon = 901,
414};
415
416
417
420
423
424
427AST_NAMESPACE_END
428
429
430
轴系类
定义 Axes.hpp:69
键值对解析器(BlockKeyValueParser)
定义 BKVParser.hpp:45
天体星历接口
定义 BodyEphemeris.hpp:38
天体姿态/指向
定义 BodyOrientation.hpp:38
天体形状基类
定义 BodyShape.hpp:30
天体
定义 CelestialBody.hpp:52
GravityField gravityField_
重力场
定义 CelestialBody.hpp:293
int getJplIndex() const
获取JPL索引
定义 CelestialBody.hpp:69
double getJ3() const
获取J3项
定义 CelestialBody.hpp:106
SharedPtr< AxesBodyMOD > axesMOD_
天体MOD轴
定义 CelestialBody.hpp:300
HAxes makeEpochAxes(Axes *sourceAxes, const TimePoint &tp, Axes *reference) const
创建新的历元轴系
定义 CelestialBody.hpp:183
double getJn(int n) const
获取Jn项
定义 CelestialBody.hpp:258
const std::string & getGravityModel() const
获取重力模型名称
定义 CelestialBody.hpp:83
SharedPtr< AxesBodyTOD > axesTOD_
天体TOD轴
定义 CelestialBody.hpp:301
SharedPtr< AxesBodyFixed > axesFixed_
天体固定轴
定义 CelestialBody.hpp:299
double getJ4() const
获取J4项
定义 CelestialBody.hpp:109
BodyEphemeris * getEphemeris() const
获取天体星历
定义 CelestialBody.hpp:149
ScopedPtr< BodyOrientation > orientation_
天体姿态
定义 CelestialBody.hpp:295
CelestialBody * getParent() const
获取父天体
定义 CelestialBody.hpp:79
double getJ2() const
获取J2项
定义 CelestialBody.hpp:103
Axes * getAxesTOD() const
获取天体TOD轴系
定义 CelestialBody.hpp:169
double getGM() const
获取引力常数
定义 CelestialBody.hpp:94
HAxes makeEpochAxes(Axes *sourceAxes, EventTime *time, Axes *reference) const
创建新的历元轴系
定义 CelestialBody.hpp:190
Axes * getAxesMOD() const
获取天体MOD轴系
定义 CelestialBody.hpp:166
Point * getPointCenter() const
获取天体中心
定义 CelestialBody.hpp:157
Axes * getAxesFixed() const
获取天体固定轴系
定义 CelestialBody.hpp:163
double getSystemGM() const
获取系统引力常数
定义 CelestialBody.hpp:97
ScopedPtr< BodyShape > shape_
天体形状
定义 CelestialBody.hpp:294
double getRadius() const
获取天体半径
定义 CelestialBody.hpp:91
WeakPtr< SolarSystem > solarSystem_
太阳系指针
定义 CelestialBody.hpp:285
std::string name_
天体名称
定义 CelestialBody.hpp:287
SharedPtr< AxesBodyInertial > axesInertial_
天体惯性轴
定义 CelestialBody.hpp:298
bool isEarth() const
是否为地球
定义 CelestialBody.hpp:118
BodyOrientation * getOrientation() const
获取天体姿态
定义 CelestialBody.hpp:152
const std::string & getName() const override
获取天体名称
定义 CelestialBody.hpp:61
const GravityField & getGravityField() const
获取天体重力场
定义 CelestialBody.hpp:146
double getJ6() const
获取J6项
定义 CelestialBody.hpp:115
Axes * getAxesInertial() const
获取天体惯性轴系
定义 CelestialBody.hpp:160
SharedPtr< CelestialBody > parent_
父天体
定义 CelestialBody.hpp:286
ScopedPtr< BodyEphemeris > ephemeris_
天体星历
定义 CelestialBody.hpp:296
int getJplSpiceId() const
获取JPL SPICE ID
定义 CelestialBody.hpp:65
double getJ5() const
获取J5项
定义 CelestialBody.hpp:112
事件时间
定义 EventTime.hpp:42
坐标系类
定义 Frame.hpp:59
重力场系数
定义 GravityField.hpp:63
@ eEarth
地球
定义 JplDe.hpp:48
定义 Point.hpp:37
virtual Frame * getFrame() const =0
获取点所在的参考坐标系
定义 ScopedPtr.hpp:59
太阳系
定义 SolarSystem.hpp:53
绝对时间点
定义 TimePoint.hpp:106
弱引用指针
定义 WeakPtr.hpp:34
ESpiceId
SPICE 天体ID
定义 CelestialBody.hpp:314
HAxes aMakeEpochAxes(Axes *sourceAxes, const TimePoint &tp, Axes *referenceAxes)
创建一个历元轴系
定义 AxesAPI.cpp:27