interpolation
— ALE Interpolation Functions¶
-
namespace ale
Enums
Functions
-
double linearInterpolate(double x, double y, double t)¶
Linearly interpolate between two values.
- Parameters
x – The first value.
y – The second value.
t – The distance to interpolate. 0 is x and 1 is y.
- Returns
The interpolated value
-
std::vector<double> linearInterpolate(const std::vector<double> &x, const std::vector<double> &y, double t)¶
Linearly interpolate between two vectors.
- Parameters
x – The first vectors.
y – The second vectors.
t – The distance to interpolate. 0 is x and 1 is y.
- Returns
The interpolated vector
-
Vec3d linearInterpolate(const Vec3d &x, const Vec3d &y, double t)¶
Linearly interpolate between two 3D vectors.
- Parameters
x – The first vectors.
y – The second vectors.
t – The distance to interpolate. 0 is x and 1 is y.
- Returns
The interpolated vector
-
int interpolationIndex(const std::vector<double> ×, double interpTime)¶
Compute the index of the first time to use when interpolating at a given time.
- Parameters
times – The ordered vector of times to search. Must have at least 2 times.
interpTime – The time to search for the interpolation index of.
- Returns
int The index of the time that comes before interpTime. If there is no time that comes before interpTime, then returns 0. If all times come before interpTime, then returns the second to last index.
-
std::vector<double> orderedVecMerge(const std::vector<double> &x, const std::vector<double> &y)¶
Merge, sort, and remove duplicates from two vectors
- Parameters
x – The first vector to merge
y – The second vector to merge
- Returns
A new vector containing unique, sorted values from the two input vectors
-
double evaluateCubicHermite(const double interpTime, const std::vector<double> &derivs, const std::vector<double> &x, const std::vector<double> &y)¶
Evaluates a cubic hermite spline at an input time.
migrated from Isis::NumericalApproximation
- Parameters
interpTime – The time to interpolate at, should be in the same units as x
x – The times of the spline nodes
derivs – The derivatives of the spline at the nodes
y – The values of the spline at the nodes
- Returns
The value of the spline at the input time
-
double evaluateCubicHermiteFirstDeriv(const double interpTime, const std::vector<double> &deriv, const std::vector<double> ×, const std::vector<double> &y)¶
Evaluate the first derivative of a cubic hermite spline at an input time.
- Parameters
interpTime – The time to interpolate at, should be in the same units as x
x – The times of the spline nodes
derivs – The derivatives of the spline at the nodes
y – The values of the spline at the nodes
- Returns
The first derivative of the spline at the input time
-
double lagrangeInterpolate(const std::vector<double> ×, const std::vector<double> &values, double time, int order = 8)¶
Interpolate a set of values using lagrange polynomials.
- Parameters
times – The vector of times to interpolate over
values – The vector of values to interpolate between
time – The time to interpolate at
order – The order of the lagrange polynomials to use
- Returns
The interpolated value
-
double lagrangeInterpolateDerivative(const std::vector<double> ×, const std::vector<double> &values, double time, int order = 8)¶
Interpolate the first derivative of a set of values using lagrange polynomials.
- Parameters
times – The vector of times to interpolate over
values – The vector of values to interpolate between
time – The time to interpolate at
order – The order of the lagrange polynomials to use
- Returns
The interpolated first derivative
-
double interpolate(std::vector<double> points, std::vector<double> times, double time, PositionInterpolation interp, int d)¶
Interpolates a value from a set of points and times.
- Parameters
points – A vector of points
times – A vector of times
time – The time to interpolate at
interp – An interpolation enum dictating what type of interpolation to use
d – The order of the derivative to generate when interpolating (Currently supports 0, 1, and 2)
- Returns
The interpolated value
-
double linearInterpolate(double x, double y, double t)¶