isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Orbit.h
1 #pragma once
2 
3 #include <isce3/error/ErrorCode.h>
4 #include <vector>
5 
6 #include "DateTime.h"
7 #include "Linspace.h"
8 #include "StateVector.h"
9 #include "TimeDelta.h"
10 #include "Vector.h"
11 
12 namespace isce3 { namespace core {
13 
20 enum class OrbitInterpMethod {
21  Hermite,
22  Legendre,
23 };
24 
27  Error,
28  Extrapolate,
29  FillNaN,
30 };
31 
43 class Orbit {
44 public:
45 
46  Orbit() = default;
47 
56  Orbit(const std::vector<StateVector> & statevecs,
58 
66  Orbit(const std::vector<StateVector> & statevecs,
67  const DateTime & reference_epoch,
69 
71  std::vector<StateVector> getStateVectors() const;
72 
74  void setStateVectors(const std::vector<StateVector> &);
75 
77  const DateTime & referenceEpoch() const { return _reference_epoch; }
78 
80  void referenceEpoch(const DateTime &);
81 
83  OrbitInterpMethod interpMethod() const { return _interp_method; }
84 
86  void interpMethod(OrbitInterpMethod interp_method) { _interp_method = interp_method; }
87 
89  double startTime() const { return _time[0]; }
90 
92  double midTime() const { return startTime() + 0.5 * (size() - 1) * spacing(); }
93 
95  double endTime() const { return _time[size()-1]; }
96 
98  DateTime startDateTime() const { return _reference_epoch + TimeDelta(startTime()); }
99 
101  DateTime midDateTime() const { return _reference_epoch + TimeDelta(midTime()); }
102 
104  DateTime endDateTime() const { return _reference_epoch + TimeDelta(endTime()); }
105 
107  double spacing() const { return _time.spacing(); }
108 
110  int size() const { return _time.size(); }
111 
113  const Linspace<double> & time() const { return _time; }
114 
116  const std::vector<Vec3> & position() const { return _position; }
117 
119  const std::vector<Vec3> & velocity() const { return _velocity; }
120 
122  double time(int idx) const { return _time[idx]; }
123 
125  const Vec3 & position(int idx) const { return _position[idx]; }
126 
128  const Vec3 & velocity(int idx) const { return _velocity[idx]; }
129 
144  isce3::error::ErrorCode
145  interpolate(Vec3* position, Vec3* velocity, double t,
146  OrbitInterpBorderMode border_mode =
148 
149 private:
150  DateTime _reference_epoch;
151  Linspace<double> _time;
152  std::vector<Vec3> _position;
153  std::vector<Vec3> _velocity;
155 };
156 
157 bool operator==(const Orbit &, const Orbit &);
158 bool operator!=(const Orbit &, const Orbit &);
159 
164 constexpr
166 {
167  switch (method) {
168  case OrbitInterpMethod::Hermite : return 4;
169  case OrbitInterpMethod::Legendre : return 9;
170  }
171 
172  return -1;
173 }
174 
175 }}
Eighth-order Legendre polynomial interpolation.
Raise error if interpolation attempted outside orbit domain.
CUDA_HOSTDEV constexpr int size() const
Number of samples.
Definition: Linspace.h:86
DateTime startDateTime() const
UTC time of first state vector.
Definition: Orbit.h:98
double spacing() const
Time interval between state vectors (s)
Definition: Orbit.h:107
const DateTime & referenceEpoch() const
Reference epoch (UTC)
Definition: Orbit.h:77
Output NaN for interpolation points outside orbit domain.
Data structure to store date time to nano-sec precision.
Definition: DateTime.h:18
OrbitInterpMethod
Orbit interpolation method.
Definition: Orbit.h:20
const std::vector< Vec3 > & position() const
Get state vector positions in ECEF coordinates (m)
Definition: Orbit.h:116
constexpr int minStateVecs(OrbitInterpMethod method)
Get minimum number of orbit state vectors required for interpolation with specified method...
Definition: Orbit.h:165
double endTime() const
Time of last state vector relative to reference epoch (s)
Definition: Orbit.h:95
double startTime() const
Time of first state vector relative to reference epoch (s)
Definition: Orbit.h:89
OrbitInterpMethod interpMethod() const
Interpolation method.
Definition: Orbit.h:83
CUDA_HOSTDEV constexpr T spacing() const
Sample spacing.
Definition: Linspace.h:76
Data structure to store TimeDelta to double precision seconds.
Definition: TimeDelta.h:16
Allow extrapolation to points outside orbit domain.
double time(int idx) const
Get the specified state vector time relative to reference epoch (s)
Definition: Orbit.h:122
DateTime endDateTime() const
UTC time of last state vector.
Definition: Orbit.h:104
const Linspace< double > & time() const
Get state vector times relative to reference epoch (s)
Definition: Orbit.h:113
int size() const
Number of state vectors in orbit.
Definition: Orbit.h:110
double midTime() const
Time of center of orbit relative to reference epoch (s)
Definition: Orbit.h:92
isce3::error::ErrorCode interpolate(Vec3 *position, Vec3 *velocity, double t, OrbitInterpBorderMode border_mode=OrbitInterpBorderMode::Error) const
Interpolate platform position and/or velocity.
Definition: Orbit.cpp:61
const Vec3 & velocity(int idx) const
Get the specified state vector velocity in ECEF coordinates (m/s)
Definition: Orbit.h:128
Third-order Hermite polynomial interpolation.
void setStateVectors(const std::vector< StateVector > &)
Set orbit state vectors.
Definition: Orbit.cpp:42
const Vec3 & position(int idx) const
Get the specified state vector position in ECEF coordinates (m)
Definition: Orbit.h:125
OrbitInterpBorderMode
Mode determining how interpolation outside of orbit domain is handled.
Definition: Orbit.h:26
void interpMethod(OrbitInterpMethod interp_method)
Set interpolation method.
Definition: Orbit.h:86
const std::vector< Vec3 > & velocity() const
Get state vector velocities in ECEF coordinates (m/s)
Definition: Orbit.h:119
Sequence of platform ephemeris samples (state vectors) with uniform temporal spacing, supporting efficient lookup and interpolation.
Definition: Orbit.h:43
DateTime midDateTime() const
UTC time of center of orbit.
Definition: Orbit.h:101
std::vector< StateVector > getStateVectors() const
Export list of state vectors.
Definition: Orbit.cpp:31

Generated for ISCE3.0 by doxygen 1.8.5.