Function lupnt::FitChebyshevModel

Function Documentation

inline ChebyshevFitModel lupnt::FitChebyshevModel(const std::function<VecXd(double)> &sample, double t_start, double t_end, int num_dims, double segment_length, int num_coeffs)

Fit a piecewise Chebyshev polynomial model to a sampled num_dims-dimensional function of time.

Samples sample(t) at the num_coeffs Chebyshev-Gauss nodes of [t_start, t_end], split into approximately segment_length-long equal segments, and fits a degree-(num_coeffs-1) Chebyshev polynomial to each segment via the standard discrete Chebyshev transform (DCT-II) &#8212; i.e. the unique polynomial interpolant of sample at the Chebyshev-Gauss nodes, expressed in the T_n basis with the constant term first.

Used by InitFrameConversionFromSpice to fit SPICE-derived Earth orientation parameters (via ComputeEopFromSpice) over a time window, and by GnssConstellation’s internal FitStateHistoryChebyshev helper to fit a satellite’s ECI state history for fast ephemeris lookups (see GnssConstellation::GetSatelliteStateChebyshevEci).

Parameters:
  • sample – Function returning the num_dims-dimensional sample vector at a given epoch [s, seconds relative to J2000]

  • t_start – Start of the fit window [s, seconds relative to J2000]

  • t_end – End of the fit window [s, seconds relative to J2000]

  • num_dims – Dimensionality of sample’s output

  • segment_length – Target length of each Chebyshev fit segment [s]

  • num_coeffs – Number of Chebyshev coefficients (polynomial degree + 1) per dimension and segment

Returns:

Fitted piecewise model, evaluable via ChebyshevFitModel::Eval