🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
EclipseEventFinder.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/CelestialBody.hpp"
25#include "AstCore/TimePoint.hpp"
26#include "AstCore/TimeInterval.hpp"
27#include "AstCore/Point.hpp"
28#include "AstCore/Frame.hpp"
29
30#include <string>
31#include <vector>
32
33AST_NAMESPACE_BEGIN
34
44class AST_CORE_API EclipseEvent
45{
46public:
49 CelestialBody* getObstruction() const { return obstruction_.get(); }
50 const TimePoint& getPenumbraStart() const { return penumbraStart_; }
51 const TimePoint& getUmbraStart() const { return umbraStart_; }
52 const TimePoint& getUmbraStop() const { return umbraStop_; }
53 const TimePoint& getPenumbraStop() const { return penumbraStop_; }
54 double getMaxShadowRatio() const { return maxShadowRatio_; }
55 const TimePoint& getTimeAtMaxShadow() const { return timeAtMaxShadow_; }
56 bool hasUmbra() const { return hasUmbra_; }
58
62 double getUmbraDuration() const { return umbraStop_ - umbraStart_; }
64 double getPenumbraDuration() const { return (umbraStart_ - penumbraStart_) + (penumbraStop_ - umbraStop_); }
66 double getTotalDuration() const { return penumbraStop_ - penumbraStart_; }
68 std::string getObstructionName() const
69 {
70 CelestialBody* b = obstruction_.get();
71 return b ? b->getName() : std::string{};
72 }
74 double getMinIntensity() const { return 1.0 - maxShadowRatio_; }
76 const TimePoint& getTimeAtMinIntensity() const { return timeAtMaxShadow_; }
78
81 void setObstruction(CelestialBody* b) { obstruction_ = b; }
82 void setPenumbraStart(const TimePoint& t) { penumbraStart_ = t; }
83 void setUmbraStart(const TimePoint& t) { umbraStart_ = t; }
84 void setUmbraStop(const TimePoint& t) { umbraStop_ = t; }
85 void setPenumbraStop(const TimePoint& t) { penumbraStop_ = t; }
86 void setMaxShadowRatio(double r) { maxShadowRatio_ = r; }
87 void setTimeAtMaxShadow(const TimePoint& t) { timeAtMaxShadow_ = t; }
88 void setHasUmbra(bool b) { hasUmbra_ = b; }
90
91private:
92 WBody obstruction_{};
93 TimePoint penumbraStart_{};
94 TimePoint umbraStart_{};
95 TimePoint umbraStop_{};
96 TimePoint penumbraStop_{};
97 double maxShadowRatio_{0.0};
98 TimePoint timeAtMaxShadow_{};
99 bool hasUmbra_{false};
100};
101
105class AST_CORE_API EclipseEventFinder
106{
107public:
108 EclipseEventFinder() = default;
109 ~EclipseEventFinder() = default;
110
111 EclipseEventFinder(const EclipseEventFinder&) = default;
112 EclipseEventFinder& operator=(const EclipseEventFinder&) = default;
113
116 void setPoint(Point* p) { point_ = p; }
117 void setLightSource(CelestialBody* b) { lightSource_ = b; }
118 void setOccultingBodies(const std::vector<HCelestialBody>& bodies) { occultingBodies_ = bodies; }
119 void setStepSize(double s) { stepSize_ = s; }
121
128 errc_t find(const TimeInterval& interval, std::vector<EclipseEvent>& events) const;
129
130private:
131 WeakPtr<Point> point_{nullptr};
132 WeakPtr<CelestialBody> lightSource_{nullptr};
133 std::vector<HCelestialBody> occultingBodies_{};
134 double stepSize_{60.0};
135};
136
139AST_NAMESPACE_END
天体
定义 CelestialBody.hpp:72
日食事件求解器
定义 EclipseEventFinder.hpp:106
单个日食事件
定义 EclipseEventFinder.hpp:45
double getMinIntensity() const
最小光照强度 [0,1](= 1 - 最大遮蔽比例)
定义 EclipseEventFinder.hpp:74
std::string getObstructionName() const
遮挡体名称(无遮挡体时为空串)
定义 EclipseEventFinder.hpp:68
double getTotalDuration() const
总遮蔽时长 [s]
定义 EclipseEventFinder.hpp:66
double getPenumbraDuration() const
半影时长 [s](进入段 + 退出段之和;掠影时退化为单段半影)
定义 EclipseEventFinder.hpp:64
const TimePoint & getTimeAtMinIntensity() const
最小光照强度时刻(= 最大遮蔽时刻)
定义 EclipseEventFinder.hpp:76
const std::string & getName() const override
获取对象名称
定义 ObjectNamed.hpp:48
点抽象基类
定义 Point.hpp:41
时间区间
定义 TimeInterval.hpp:64
绝对时间点
定义 TimePoint.hpp:108
弱引用指针
定义 WeakPtr.hpp:35
WCelestialBody WBody
天体弱引用
定义 CelestialBody.hpp:476
Unit s
定义 Unit.cpp:465