Method | Description | |
---|---|---|
Compute ( float x, float y, float xs, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : float[] |
Static all-in-one method to fit the splines and evaluate at X coordinates.
|
|
CubicSpline ( ) : System |
Default ctor.
|
|
CubicSpline ( float x, float y, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : System |
Construct and call Fit.
|
|
Eval ( float x, bool debug = false ) : float[] |
Evaluate the spline at the specified x coordinates. This can extrapolate off the ends of the splines. You must provide X's in ascending order. The spline must already be computed before calling this, meaning you must have already called Fit() or FitAndEval().
|
|
EvalSlope ( float x, bool debug = false ) : float[] |
Evaluate (compute) the slope of the spline at the specified x coordinates. This can extrapolate off the ends of the splines. You must provide X's in ascending order. The spline must already be computed before calling this, meaning you must have already called Fit() or FitAndEval().
|
|
Fit ( float x, float y, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : void |
Compute spline coefficients for the specified x,y points. This does the "natural spline" style for ends. This can extrapolate off the ends of the splines. You must provide points in X sort order.
|
|
FitAndEval ( float x, float y, float xs, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : float[] |
Fit x,y and then eval at points xs and return the corresponding y's. This does the "natural spline" style for ends. This can extrapolate off the ends of the splines. You must provide points in X sort order.
|
|
FitGeometric ( float x, float y, float directions, int nOutputPoints, float &xs, float &ys ) : void |
Fit the input x,y points using a 'geometric' strategy so that y does not have to be a single-valued function of x.
|
Method | Description | |
---|---|---|
CheckAlreadyFitted ( ) : void |
Throws if Fit has not been called.
|
|
EvalSpline ( float x, int j, bool debug = false ) : float |
Evaluate the specified x value using the specified spline.
|
|
GetNextXIndex ( float x ) : int |
Find where in xOrig the specified x falls, by simultaneous traverse. This allows xs to be less than x[0] and/or greater than x[n-1]. So allows extrapolation. This keeps state, so requires that x be sorted and xs called in ascending order, and is not multi-thread safe.
|
public static Compute ( float x, float y, float xs, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : float[] | ||
x | float | Input. X coordinates to fit. |
y | float | Input. Y coordinates to fit. |
xs | float | Input. X coordinates to evaluate the fitted curve at. |
startSlope | float | Optional slope constraint for the first point. Single.NaN means no constraint. |
endSlope | float | Optional slope constraint for the final point. Single.NaN means no constraint. |
debug | bool | Turn on console output. Default is false. |
return | float[] |
public CubicSpline ( float x, float y, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : System | ||
x | float | Input. X coordinates to fit. |
y | float | Input. Y coordinates to fit. |
startSlope | float | Optional slope constraint for the first point. Single.NaN means no constraint. |
endSlope | float | Optional slope constraint for the final point. Single.NaN means no constraint. |
debug | bool | Turn on console output. Default is false. |
return | System |
public Eval ( float x, bool debug = false ) : float[] | ||
x | float | Input. X coordinates to evaluate the fitted curve at. |
debug | bool | Turn on console output. Default is false. |
return | float[] |
public EvalSlope ( float x, bool debug = false ) : float[] | ||
x | float | Input. X coordinates to evaluate the fitted curve at. |
debug | bool | Turn on console output. Default is false. |
return | float[] |
public Fit ( float x, float y, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : void | ||
x | float | Input. X coordinates to fit. |
y | float | Input. Y coordinates to fit. |
startSlope | float | Optional slope constraint for the first point. Single.NaN means no constraint. |
endSlope | float | Optional slope constraint for the final point. Single.NaN means no constraint. |
debug | bool | Turn on console output. Default is false. |
return | void |
public FitAndEval ( float x, float y, float xs, float startSlope = float.NaN, float endSlope = float.NaN, bool debug = false ) : float[] | ||
x | float | Input. X coordinates to fit. |
y | float | Input. Y coordinates to fit. |
xs | float | Input. X coordinates to evaluate the fitted curve at. |
startSlope | float | Optional slope constraint for the first point. Single.NaN means no constraint. |
endSlope | float | Optional slope constraint for the final point. Single.NaN means no constraint. |
debug | bool | Turn on console output. Default is false. |
return | float[] |
public static FitGeometric ( float x, float y, float directions, int nOutputPoints, float &xs, float &ys ) : void | ||
x | float | Input x coordinates. |
y | float | Input y coordinates, do not need to be a single-valued function of x. |
directions | float | |
nOutputPoints | int | How many output points to create. |
xs | float | Output (interpolated) x values. |
ys | float | Output (interpolated) y values. |
return | void |