Vulcan
Aerospace Engineering Utilities Built on Janus
Loading...
Searching...
No Matches
ECEFProvider.hpp
Go to the documentation of this file.
1// Vulcan ECEF Provider
2// ECEF <-> ECI transform provider with configurable Earth rotation input
3#pragma once
4
7
8#include <janus/math/Trig.hpp>
9
10#include <memory>
11
12namespace vulcan {
13
19
21template <typename Scalar>
22class ECEFProvider final : public TransformProvider<Scalar> {
23 public:
24 explicit ECEFProvider(Scalar rotation_angle) {
25 c_ = janus::cos(rotation_angle);
26 s_ = janus::sin(rotation_angle);
27 }
28
29 ECEFProvider(const EarthRotationModel &model, double t_seconds) {
30 const Scalar angle = Scalar(model.ecef_to_eci_angle(t_seconds));
31 c_ = janus::cos(angle);
32 s_ = janus::sin(angle);
33 }
34
36 [[nodiscard]] Vec3<Scalar>
37 to_parent(const Vec3<Scalar> &v_ecef) const override {
38 Vec3<Scalar> result;
39 result(0) = c_ * v_ecef(0) - s_ * v_ecef(1);
40 result(1) = s_ * v_ecef(0) + c_ * v_ecef(1);
41 result(2) = v_ecef(2);
42 return result;
43 }
44
46 [[nodiscard]] Vec3<Scalar>
47 from_parent(const Vec3<Scalar> &v_eci) const override {
48 Vec3<Scalar> result;
49 result(0) = c_ * v_eci(0) + s_ * v_eci(1);
50 result(1) = -s_ * v_eci(0) + c_ * v_eci(1);
51 result(2) = v_eci(2);
52 return result;
53 }
54
55 private:
56 Scalar c_{};
57 Scalar s_{};
58};
59
60template <typename Scalar>
61[[nodiscard]] inline std::shared_ptr<ECEFProvider<Scalar>>
62make_ecef_provider(Scalar angle) {
63 return std::make_shared<ECEFProvider<Scalar>>(angle);
64}
65
66template <typename Scalar>
67[[nodiscard]] inline std::shared_ptr<ECEFProvider<Scalar>>
68make_ecef_provider(const EarthRotationModel &model, double t_seconds) {
69 return std::make_shared<ECEFProvider<Scalar>>(model, t_seconds);
70}
71
72} // namespace vulcan
ECEFProvider(const EarthRotationModel &model, double t_seconds)
Definition ECEFProvider.hpp:29
Vec3< Scalar > to_parent(const Vec3< Scalar > &v_ecef) const override
ECEF -> ECI.
Definition ECEFProvider.hpp:37
ECEFProvider(Scalar rotation_angle)
Definition ECEFProvider.hpp:24
Vec3< Scalar > from_parent(const Vec3< Scalar > &v_eci) const override
ECI -> ECEF.
Definition ECEFProvider.hpp:47
Definition Aerodynamics.hpp:11
EarthRotationFidelity
Definition ECEFProvider.hpp:14
@ IAU2006
Definition ECEFProvider.hpp:17
@ GMST
Definition ECEFProvider.hpp:16
@ ConstantOmega
Definition ECEFProvider.hpp:15
std::shared_ptr< ECEFProvider< Scalar > > make_ecef_provider(Scalar angle)
Definition ECEFProvider.hpp:62
Definition EarthModel.hpp:75
virtual double ecef_to_eci_angle(double t_seconds) const
Definition EarthModel.hpp:85
Interface for a frame edge transform (child <-> parent).
Definition TransformProvider.hpp:16