🛰️航天仿真算法库 SpaceAST 0.3.1
载入中...
搜索中...
未找到
Axes.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/Object.hpp"
25#include "AstUtil/ObjectNamed.hpp"
26
27AST_NAMESPACE_BEGIN
28
34class Rotation;
35class KinematicRotation;
36class AccelerationRotation;
37class Axes;
38using PAxes = Axes*;
40
47AST_CORE_API errc_t aAxesTransform(Axes& source, Axes& target, const TimePoint& tp, Rotation& rotation);
48AST_CORE_API errc_t aAxesTransform(Axes* source, Axes* target, const TimePoint& tp, Rotation& rotation);
49
50
57AST_CORE_API errc_t aAxesTransform(Axes& source, Axes& target, const TimePoint& tp, Matrix3d& matrix);
58AST_CORE_API errc_t aAxesTransform(Axes* source, Axes* target, const TimePoint& tp, Matrix3d& matrix);
59
60
67AST_CORE_API errc_t aAxesTransform(Axes& source, Axes& target, const TimePoint& tp, KinematicRotation& rotation);
68AST_CORE_API errc_t aAxesTransform(Axes* source, Axes* target, const TimePoint& tp, KinematicRotation& rotation);
69
70
77AST_CORE_API errc_t aAxesTransform(Axes& source, Axes& target, const TimePoint& tp, AccelerationRotation& rotation);
78AST_CORE_API errc_t aAxesTransform(Axes* source, Axes* target, const TimePoint& tp, AccelerationRotation& rotation);
79
80
85class AST_CORE_API Axes : public ObjectNamed
86{
87public:
88 AST_OBJECT(Axes)
89 ~Axes() override = default;
90 Axes() = default;
91
92 A_DISABLE_COPY(Axes)
93
94
96 virtual Axes* getParent() const = 0;
97
102 virtual errc_t getTransform(const TimePoint& tp, Rotation& rotation) const = 0;
103
108 virtual errc_t getTransform(const TimePoint& tp, KinematicRotation& rotation) const = 0;
109
114 virtual errc_t getTransform(const TimePoint& tp, AccelerationRotation& rotation) const;
115public:
119 int getDepth() const;
120
124 Axes* getAncestor(int depth) const;
125
126public:
132 A_ALWAYS_INLINE
133 errc_t getTransformTo(Axes* target, const TimePoint& tp, Rotation& rotation) const
134 {
135 return aAxesTransform(const_cast<Axes*>(this), target, tp, rotation);
136 }
137 A_ALWAYS_INLINE
138 errc_t getTransformTo(Axes& target, const TimePoint& tp, Rotation& rotation) const
139 {
140 return aAxesTransform(const_cast<Axes&>(*this), target, tp, rotation);
141 }
147 A_ALWAYS_INLINE
148 errc_t getTransformTo(Axes* target, const TimePoint& tp, KinematicRotation& rotation) const
149 {
150 return aAxesTransform(const_cast<Axes*>(this), target, tp, rotation);
151 }
152 A_ALWAYS_INLINE
153 errc_t getTransformTo(Axes& target, const TimePoint& tp, KinematicRotation& rotation) const
154 {
155 return aAxesTransform(const_cast<Axes&>(*this), target, tp, rotation);
156 }
162 A_ALWAYS_INLINE
163 errc_t getTransformFrom(Axes* source, const TimePoint& tp, Rotation& rotation) const
164 {
165 return aAxesTransform(source, const_cast<Axes*>(this), tp, rotation);
166 }
167 A_ALWAYS_INLINE
168 errc_t getTransformFrom(Axes& source, const TimePoint& tp, Rotation& rotation) const
169 {
170 return aAxesTransform(source, const_cast<Axes&>(*this), tp, rotation);
171 }
177 A_ALWAYS_INLINE
178 errc_t getTransformFrom(Axes* source, const TimePoint& tp, KinematicRotation& rotation) const
179 {
180 return aAxesTransform(source, const_cast<Axes*>(this), tp, rotation);
181 }
182 A_ALWAYS_INLINE
183 errc_t getTransformFrom(Axes& source, const TimePoint& tp, KinematicRotation& rotation) const
184 {
185 return aAxesTransform(source, const_cast<Axes&>(*this), tp, rotation);
186 }
192 A_ALWAYS_INLINE
193 errc_t getTransformFrom(Axes* source, const TimePoint& tp, AccelerationRotation& rotation) const
194 {
195 return aAxesTransform(source, const_cast<Axes*>(this), tp, rotation);
196 }
197 A_ALWAYS_INLINE
198 errc_t getTransformFrom(Axes& source, const TimePoint& tp, AccelerationRotation& rotation) const
199 {
200 return aAxesTransform(source, const_cast<Axes&>(*this), tp, rotation);
201 }
206 A_ALWAYS_INLINE
207 errc_t getTransformFromParent(const TimePoint& tp, Rotation& rotation) const
208 {
209 return getTransform(tp, rotation);
210 }
215 A_ALWAYS_INLINE
216 errc_t getTransformFromParent(const TimePoint& tp, KinematicRotation& rotation) const
217 {
218 return getTransform(tp, rotation);
219 }
220public:
226 errc_t getAttitudeIn(Axes& axes, const TimePoint& tp, Quaternion& quat) const;
227 A_ALWAYS_INLINE
228 errc_t getAttitudeIn(Axes* axes, const TimePoint& tp, Quaternion& quat) const
229 {
230 if(axes == nullptr) return eErrorNullInput;
231 return getAttitudeIn(*axes, tp, quat);
232 }
233
240 errc_t getAttitudeIn(Axes& axes, const TimePoint& tp, Quaternion& quat, Vector3d& angvel) const;
241 A_ALWAYS_INLINE
242 errc_t getAttitudeIn(Axes* axes, const TimePoint& tp, Quaternion& quat, Vector3d& angvel) const
243 {
244 if(axes == nullptr) return eErrorNullInput;
245 return getAttitudeIn(*axes, tp, quat, angvel);
246 }
247};
248
249
259AST_CORE_API errc_t aAxesRotationRateByDifference(Axes& axes, Axes& referenceAxes, const TimePoint& tp, Vector3d& angvel, double h = 0.05);
260
261using PAxes = Axes*;
262using HAxes = SharedPtr<Axes>;
263
266AST_NAMESPACE_END
加速度(二阶运动学)坐标系旋转
定义 AccelerationRotation.hpp:51
轴系抽象基类
定义 Axes.hpp:86
A_ALWAYS_INLINE errc_t getTransformFromParent(const TimePoint &tp, KinematicRotation &rotation) const
获取当前轴系相对于父轴系的运动学旋转变换
定义 Axes.hpp:216
A_ALWAYS_INLINE errc_t getTransformFrom(Axes *source, const TimePoint &tp, Rotation &rotation) const
获取源轴系到当前轴系的旋转变换
定义 Axes.hpp:163
A_ALWAYS_INLINE errc_t getTransformFrom(Axes *source, const TimePoint &tp, KinematicRotation &rotation) const
获取源轴系到当前轴系的运动学旋转变换
定义 Axes.hpp:178
A_ALWAYS_INLINE errc_t getTransformFromParent(const TimePoint &tp, Rotation &rotation) const
获取当前轴系相对于父轴系的旋转变换
定义 Axes.hpp:207
A_ALWAYS_INLINE errc_t getTransformTo(Axes *target, const TimePoint &tp, KinematicRotation &rotation) const
获取当前轴系到目标轴系的运动学旋转变换
定义 Axes.hpp:148
A_ALWAYS_INLINE errc_t getTransformFrom(Axes *source, const TimePoint &tp, AccelerationRotation &rotation) const
获取源轴系到当前轴系的加速度旋转变换
定义 Axes.hpp:193
运动学坐标系旋转
定义 KinematicRotation.hpp:50
命名对象
定义 ObjectNamed.hpp:36
四元数
定义 Quaternion.hpp:48
坐标系旋转类
定义 Rotation.hpp:55
绝对时间点
定义 TimePoint.hpp:108
Axes * PAxes
轴系指针(pointer to axes)
定义 Axes.hpp:38
errc_t aAxesRotationRateByDifference(Axes &axes, Axes &referenceAxes, const TimePoint &tp, Vector3d &angvel, double h)
用有限差分计算轴系相对于参考轴系的角速度
定义 Axes.cpp:337
SharedPtr< Axes > HAxes
轴系句柄(handle to axes)
定义 Axes.hpp:39
errc_t aAxesTransform(Axes &source, Axes &target, const TimePoint &tp, Rotation &rotation)
计算轴系之间的旋转变换。
定义 Axes.cpp:291