🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
EphemerisBinary.hpp
浏览该文件的文档.
1
21
22#pragma once
23
24#include "AstGlobal.h"
25#include "AstCore/Ephemeris.hpp"
26#include "AstCore/TimePoint.hpp"
27#include "AstCore/Frame.hpp"
28#include "AstCore/Interval.hpp"
29#include "AstMath/Vector.hpp"
30#include <vector>
31#include <string>
32
33AST_NAMESPACE_BEGIN
34
58class AST_CORE_API EphemerisBinary final: public Ephemeris
59{
60public:
61 static EphemerisBinary* New();
62
63 EphemerisBinary() = default;
64 ~EphemerisBinary() override = default;
65
66public:
71 errc_t saveFrom(const Ephemeris* source, const std::string& filepath);
72
76 errc_t open(const std::string& filepath);
77
78public: // Ephemeris 接口
79 Frame* getFrame() const override;
80 errc_t getPos(const TimePoint& tp, Vector3d& pos) const override;
81 errc_t getPosVel(const TimePoint& tp, Vector3d& pos, Vector3d& vel) const override;
82 errc_t getInterval(TimeInterval& interval) const override;
83
84private:
86 void fillWindow(size_t idx) const;
87
89 int findIndex(double delta) const;
90
91 static constexpr uint32_t MAGIC = 0x41535445; // "ASTE"
92 static constexpr uint32_t VERSION = 1;
93 static constexpr size_t WINDOW_SIZE = 256; // 固定窗口大小
94 static constexpr int INTERP_ORDER = 5; // Lagrange 插值阶数
95
96 TimePoint epoch_{};
97 Interval interval_{};
98 double averageStep_{60.0};
99 size_t pointCount_{0};
100 std::string filepath_;
101 std::string frameName_;
102 mutable SharedPtr<Frame> frame_;
103
104 // 固定窗口缓存
105 static constexpr size_t HEADER_BASE = 56; // 基础头大小 (不含变长帧名)
106 static constexpr size_t POINT_BYTES = 56; // 7 doubles per point
107 mutable std::vector<double> winTimes_;
108 mutable std::vector<Vector3d> winPos_;
109 mutable std::vector<Vector3d> winVel_;
110 mutable size_t winStart_{0};
111};
112
115AST_NAMESPACE_END
文件后备星历
定义 EphemerisBinary.hpp:59
星历接口
定义 Ephemeris.hpp:44
virtual errc_t getPos(const TimePoint &tp, Vector3d &pos) const override=0
获取点在指定时间点的位置,相对于点的参考坐标系
virtual errc_t getPosVel(const TimePoint &tp, Vector3d &pos, Vector3d &vel) const override=0
获取点在指定时间点的位置和速度,相对于点的参考坐标系
virtual Frame * getFrame() const override=0
获取点所在的参考坐标系
坐标系类
定义 Frame.hpp:60
相对时间区间
定义 Interval.hpp:37
共享指针
定义 SharedPtr.hpp:33
时间区间
定义 TimeInterval.hpp:60
绝对时间点
定义 TimePoint.hpp:107