Program Listing for File frame_converter.h

Return to documentation for file (conversions/frame_converter.h)

#pragma once

#include <functional>
#include <map>
#include <ostream>

#include "lupnt/core/constants.h"

namespace lupnt {

  class State;
  enum class Axis { X = 0, Y = 1, Z = 2 };

  enum class Frame {
    // Earth
    UNDEFINED,    // No frame
    ICRF,         // International Celestial Reference System
    ITRF,         // International Terrestrial Reference Frame
    ECEF = ITRF,  // Earth-Centered Earth-Fixed
    GCRF,         // Geocentric Reference System
    EME,          // Earth-Centered mean equator and equinox at J2000
    ECI = EME,    // Earth-Centered Inertial
    SER,          // Sun-Earth Rotating Frame
    GSE,          // Geocentric Solar Ecliptic
    MOD,          // Mean of date equatorial system
    TOD,          // True of date equatorial system
    EMR,          // Earth-Moon Rotating Frame
    // Moon
    MOON_CI,  // Moon-centered Inertial Frame (Axis aligened with ICRF)
    MOON_PA,  // Moon-Fixed with principal axes
    MOON_ME,  // Moon-Fixed with mean-Earth / polar axes
    MOON_OP,  // Earth Orbit Frame
    // Solar System
    MERCURY_FIXED,  // Mercury fixed frame
    VENUS_FIXED,    // Venus fixed frame
    MARS_FIXED,     // Mars fixed frame
    JUPITER_FIXED,  // Jupiter fixed frame
    SATURN_FIXED,   // Saturn fixed frame
    URANUS_FIXED,   // Uranus fixed frame
    NEPTUNE_FIXED,  // Neptune fixed frame
    // Inertial
    MERCURY_CI,  // Mercury-centered Inertial Frame
    VENUS_CI,    // Venus-centered Inertial Frame
    MARS_CI,     // Mars-centered Inertial Frame
    JUPITER_CI,  // Jupiter-centered Inertial Frame
    SATURN_CI,   // Saturn-centered Inertial Frame
    URANUS_CI,   // Uranus-centered Inertial Frame
    NEPTUNE_CI,  // Neptune-centered Inertial Frame
  };

  std::ostream &operator<<(std::ostream &os, Frame frame);

  extern const std::map<Frame, BodyId> frame_centers;

  BodyId GetFrameCenter(Frame frame);

  extern std::map<std::pair<Frame, Frame>, std::function<Vec6(Real, const Vec6 &rv)>>
      frame_conversions;

  Vec3 ConvertFrame(Real t_tdb, const Vec3 &r_in, Frame frame_in, Frame frame_out,
                    bool rotate_only = false);

  Vec6 ConvertFrame(Real t_tdb, const Vec6 &rv_in, Frame frame_in, Frame frame_out,
                    bool rotate_only = false);

  MatX6 ConvertFrame(Real t_tdb, const MatX6 &rv_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  MatX3 ConvertFrame(Real t_tdb, const MatX3 &r_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  MatX6 ConvertFrame(const VecX &t_tdb, const Vec6 &rv_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  MatX3 ConvertFrame(const VecX &t_tdb, const Vec3 &r_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  MatX6 ConvertFrame(const VecX &t_tdb, const MatX6 &rv_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  MatX3 ConvertFrame(const VecX &t_tdb, const MatX3 &r_in, Frame frame_in, Frame frame_out,
                     bool rotate_only = false);

  State ConvertFrame(Real t_tdb, const State &x_in, Frame frame_out, bool rotate_only = false);

  std::pair<Mat3, Vec3> GetFrameRotationTranslation(Real t_tdb, Frame from_frame, Frame to_frame);

  std::pair<Mat6, Vec6> GetFrameRotationTranslationRv(Real t_tdb, Frame from_frame, Frame to_frame);

}  // namespace lupnt