- Timestamp:
- Jan 23, 2023, 7:10:15 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/psLib.20230123/src/math/psSpline.h
r23486 r42319 5 5 * and evaluate splines. 6 6 * 7 * @author GLG, MHPCC 7 * @author GLG (MHPCC) 8 * reworked by EAM (IfA) 8 9 * 9 10 * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $ … … 27 28 #include "psPolynomial.h" 28 29 29 #define PS_LEFT_SPLINE_DERIV 0.0 30 #define PS_RIGHT_SPLINE_DERIV 0.0 31 32 /** One-Dimensional Spline */ 30 /** One-Dimensional Spline 31 This structure represents a 1D cubic spline. Note the option for 32 equally-spaced knots allows a quick selection of the correct spline 33 segment. The values (xMin, xMax, xDel) are stored for ease of access. 34 */ 33 35 typedef struct 34 36 { 35 37 unsigned int n; ///< The number of spline pieces 36 psPolynomial1D **spline; ///< An array of n pointers to the spline polynomials 37 psVector *knots; ///< The boundaries between each spline piece. Size is n+1. 38 psF32 *p_psDeriv2; ///< For cubic splines, the second derivative at each domain point. Size is n+1. 38 psF32 *xKnots; ///< x-coordinate of the knots (n+1) 39 psF32 *yKnots; ///< y-coordinate of the knots (n+1) 40 psF32 *d2yKnots; ///< 2nd derivative of y at the knots (n+1) 41 bool equalSpacing; // if knots are equally spaced, the seqment choice can be optimized 42 psF32 xMin; // for equally-spaced knots, the value at the lower bound (xKnots[0]) 43 psF32 xMax; // for equally-spaced knots, the value at the upper bound (xKnots[n]) 44 psF32 xDel; // for equally-spaced knots, the spacing (xKnots[n] - xKnots[0])/n 39 45 } 40 46 psSpline1D; 41 47 42 /** Allocates a psSpline1D structure 43 * 44 * Allocator for psSpline1D. 48 /** Allocator for psSpline1D. 45 49 * 46 50 * @return psSpline1D* new 1-D spline struct … … 53 57 */ 54 58 float psSpline1DEval( 55 const psSpline1D *spline, ///< Coefficients for spline polynomials59 const psSpline1D *spline, ///< spline pointer 56 60 float x ///< location at which to evaluate 57 61 ); … … 71 75 * generates the linear splines which satisfy those data points. 72 76 * 77 * XXX EAM: add option to generate / select a subset of knots from the data 78 * 73 79 * @return psSpline1D*: the calculated one-dimensional splines 74 80 */ 75 psSpline1D *ps VectorFitSpline1D(81 psSpline1D *psSpline1DFitVector( 76 82 const psVector* x, ///< Ordinates (or NULL to just use the indices) 77 83 const psVector* y ///< Coordinates
Note:
See TracChangeset
for help on using the changeset viewer.
