🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
DataGroupPointPrv.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include <cmath>
24
25#include "AstGlobal.h"
26#include "AstReport/DataGroupTimeVar.hpp"
27#include "AstCore/Point.hpp"
28#include "AstCore/Frame.hpp"
29#include "AstMath/Vector.hpp"
30#include "AstUtil/Span.hpp"
31
32AST_NAMESPACE_BEGIN
33
42{
43public:
44 struct Data
45 {
46 TimePoint time_;
47 Vector3d pos_;
48 Vector3d vel_;
49
50 const TimePoint& getTime() const { return time_; }
51
52 // 位置分量 & 模
53 double getX() const { return pos_.x(); }
54 double getY() const { return pos_.y(); }
55 double getZ() const { return pos_.z(); }
56 double getMagnitude() const { return pos_.norm(); }
57
58 // 方向余弦
59 double getXOverMag() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : pos_.x() / m; }
60 double getYOverMag() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : pos_.y() / m; }
61 double getZOverMag() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : pos_.z() / m; }
62
63 // 球面角
64 double getRightAscension() const { return std::atan2(pos_.y(), pos_.x()); }
65 double getDeclination() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : std::asin(pos_.z() / m); }
66 double getCoDeclination() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : std::acos(pos_.z() / m); }
67 double getNegativeDeclination() const { return -getDeclination(); }
68
69 // 方向角
70 double getDirectionAngleX() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : std::acos(pos_.x() / m); }
71 double getDirectionAngleY() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : std::acos(pos_.y() / m); }
72 double getDirectionAngleZ() const { double m = pos_.norm(); return (m < 1e-12) ? 0.0 : std::acos(pos_.z() / m); }
73
74 // 速度
75 double getVelocityX() const { return vel_.x(); }
76 double getVelocityY() const { return vel_.y(); }
77 double getVelocityZ() const { return vel_.z(); }
78 double getVelocityMagnitude() const { return vel_.norm(); }
79
80 // Detic 坐标 — 需要 BodyShape,暂不支持
81 // double getDeticLatitude() const;
82 // double getDeticLongitude() const;
83 // double getDeticAltitude() const;
84 };
85 static DataElements Elements();
86
87 DataGroupPointPrv() = default;
88 ~DataGroupPointPrv() = default;
89public:
90 errc_t calculate(const TimeList& timeList, VariantVector& result) const override;
91 const DataElements& getElements() const override;
92public:
93 errc_t calculate(const TimeList& timeList, std::vector<Data>& result) const;
94 errc_t calculate(const TimeList& timeList, Span<Data> result) const;
95public:
96 Point* getPoint() const { return point_.get(); }
97 Frame* getFrame() const { return frame_.get(); }
98private:
99 WeakPtr<Point> point_{};
100 WeakPtr<Frame> frame_{};
101};
102
103
106AST_NAMESPACE_END
数据元素容器
定义 DataElements.hpp:90
点位置数据组 (派生量) — 分量、模、方向余弦、球面角、方向角、速度
定义 DataGroupPointPrv.hpp:42
随时间变化的数据组
定义 DataGroupTimeVar.hpp:37
坐标系抽象基类
定义 Frame.hpp:62
点抽象基类
定义 Point.hpp:41
非拥有的连续对象序列视图
定义 Span.hpp:71
时间点列表
定义 TimeList.hpp:49
绝对时间点
定义 TimePoint.hpp:108
变类型向量容器
定义 VariantVector.hpp:59
Unit m
定义 Unit.cpp:456
定义 DataGroupPointPrv.hpp:45