Changeset 1423
- Timestamp:
- Aug 9, 2004, 11:23:09 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psFunctions.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psFunctions.h
r1089 r1423 26 26 /************************************************************************************************************/ 27 27 28 /** Type of polynomial */ 29 typedef enum { 30 PS_POLYNOMIAL_ORD, ///< Ordinary polynomial 31 PS_POLYNOMIAL_CHEB ///< Chebyshev polynomial 32 } psPolynomialType; 33 34 /************************************************************************************************************/ 35 28 36 /** one-dimensional polynomial */ 29 37 typedef struct { 38 psPolynomialType type; ///< Polynomial type 30 39 int n; ///< Number of terms 31 40 float *restrict coeff; ///< Coefficients … … 36 45 /** Two-dimensional polynomial */ 37 46 typedef struct { 47 psPolynomialType type; ///< Polynomial type 38 48 int nX, nY; ///< Number of terms in x and y 39 49 float *restrict *restrict coeff; ///< Coefficients … … 44 54 /** Three-dimensional polynomial */ 45 55 typedef struct { 56 psPolynomialType type; ///< Polynomial type 46 57 int nX, nY, nZ; ///< Number of terms in x, y and z 47 58 float *restrict *restrict *restrict coeff; ///< Coefficients … … 52 63 /** Four-dimensional polynomial */ 53 64 typedef struct { 65 psPolynomialType type; ///< Polynomial type 54 66 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 55 67 float *restrict *restrict *restrict *restrict coeff; ///< Coefficients … … 66 78 /** Constructor */ 67 79 psPolynomial1D *psPolynomial1DAlloc(int n ///< Number of terms 80 psPolynomialType type ///< Polynomial type 68 81 ); 69 82 /** Constructor */ 70 83 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y 84 psPolynomialType type ///< Polynomial type 71 85 ); 72 86 /** Constructor */ 73 87 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z 88 psPolynomialType type ///< Polynomial type 74 89 ); 75 90 /** Constructor */ 76 91 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 92 psPolynomialType type ///< Polynomial type 77 93 ); 78 94 … … 121 137 ); 122 138 139 /** Evaluate 1D polynomial: vector input */ 140 psVector * 141 psPolynomial1DEvalVector(psVector *x, ///< Value at which to evaluate 142 const psPolynomial1D *restrict myPoly ///< Coefficients for the polynomial 143 ); 144 145 /** Evaluate 2D polynomial: vector input */ 146 psVector * 147 psPolynomial2DEvalVector(psVector *x, ///< Value x at which to evaluate 148 psVector *y, ///< Value y at which to evaluate 149 const psPolynomial2D *restrict myPoly ///< Coefficients for the polynomial 150 ); 151 152 /** Evaluate 3D polynomial: vector input */ 153 psVector * 154 psPolynomial3DEvalVector(psVector *x, ///< Value x at which to evaluate 155 psVector *y, ///< Value y at which to evaluate 156 psVector *z, ///< Value z at which to evaluate 157 const psPolynomial3D *restrict myPoly ///< Coefficients for the polynomial 158 ); 159 160 /** Evaluate 4D polynomial: vector input */ 161 psVector * 162 psPolynomial4DEvalVector(psVector *w, ///< Value w at which to evaluate 163 psVector *x, ///< Value x at which to evaluate 164 psVector *y, ///< Value y at which to evaluate 165 psVector *z, ///< Value z at which to evaluate 166 const psPolynomial4D *restrict myPoly ///< Coefficients for the polynomial 167 ); 168 169 123 170 /* \} */ // End of MathGroup Functions 124 171 … … 129 176 /** Double-precision one-dimensional polynomial */ 130 177 typedef struct { 178 psPolynomialType type; ///< Polynomial type 131 179 int n; ///< Number of terms 132 180 double *restrict coeff; ///< Coefficients … … 137 185 /** Double-precision two-dimensional polynomial */ 138 186 typedef struct { 187 psPolynomialType type; ///< Polynomial type 139 188 int nX, nY; ///< Number of terms in x and y 140 189 double *restrict *restrict coeff; ///< Coefficients … … 145 194 /** Double-precision three-dimensional polynomial */ 146 195 typedef struct { 196 psPolynomialType type; ///< Polynomial type 147 197 int nX, nY, nZ; ///< Number of terms in x, y and z 148 198 double *restrict *restrict *restrict coeff; ///< Coefficients … … 153 203 /** Double-precision four-dimensional polynomial */ 154 204 typedef struct { 205 psPolynomialType type; ///< Polynomial type 155 206 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 156 207 double *restrict *restrict *restrict *restrict coeff; ///< Coefficients … … 165 216 166 217 /** Constructor */ 167 psDPolynomial1D *psDPolynomial1DAlloc(int n ///< Number of terms 168 ); 218 psDPolynomial1D *psDPolynomial1DAlloc(int n, ///< Number of terms 219 psPolynomialType type ///< Polynomial type 220 ); 169 221 /** Constructor */ 170 222 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y 171 ); 223 psPolynomialType type ///< Polynomial type 224 ); 172 225 /** Constructor */ 173 226 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z 174 ); 227 psPolynomialType type ///< Polynomial type 228 ); 175 229 /** Constructor */ 176 230 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 177 ); 231 psPolynomialType type ///< Polynomial type 232 ); 178 233 179 234 … … 222 277 ); 223 278 279 /** Evaluate 1D polynomial: vector input */ 280 psVector * 281 psDPolynomial1DEvalVector(psVector *x, ///< Value at which to evaluate 282 const psDPolynomial1D *restrict myPoly ///< Coefficients for the polynomial 283 ); 284 285 /** Evaluate 2D polynomial: vector input */ 286 psVector * 287 psDPolynomial2DEvalVector(psVector *x, ///< Value x at which to evaluate 288 psVector *y, ///< Value y at which to evaluate 289 const psDPolynomial2D *restrict myPoly ///< Coefficients for the polynomial 290 ); 291 292 /** Evaluate 3D polynomial: vector input */ 293 psVector * 294 psDPolynomial3DEvalVector(psVector *x, ///< Value x at which to evaluate 295 psVector *y, ///< Value y at which to evaluate 296 psVector *z, ///< Value z at which to evaluate 297 const psDPolynomial3D *restrict myPoly ///< Coefficients for the polynomial 298 ); 299 300 /** Evaluate 4D polynomial: vector input */ 301 psVector * 302 psDPolynomial4DEvalVector(psVector *w, ///< Value w at which to evaluate 303 psVector *x, ///< Value x at which to evaluate 304 psVector *y, ///< Value y at which to evaluate 305 psVector *z, ///< Value z at which to evaluate 306 const psDPolynomial4D *restrict myPoly ///< Coefficients for the polynomial 307 ); 308 224 309 /* \} */ // End of MathGroup Functions 225 310 311 /************************************************************************************************************/ 312 313 /* Splines */ 314 315 /** A 1D cubic-spline */ 316 typedef struct { 317 int n; ///< Number of spline pieces 318 psPolynomial1D *spline; ///< Array of n splines 319 float *domains; ///< The boundaries between each spline piece. Size is n+1. 320 } psSpline1D; 321 322 /** Functions **************************************************************/ 323 /** \addtogroup MathGroup Math Utilities 324 * \{ 325 */ 326 327 /** Constructors */ 328 psSpline1D *psSpline1DAlloc(int n, ///< Number of spline pieces 329 int order, ///< Order of spline pieces 330 float min, ///< Minimum data value 331 float max ///< Maximum data value 332 ); 333 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds ///< Boundaries between each spline piece. Number 334 ///< of spline pieces can hence be inferred. 335 int order ///< Order of spline pieces 336 ); 337 /** Destructor */ 338 void psSpline1DFree(psSpline1D *mySpline ///< Spline to destroy 339 ); 340 /** Evaluator */ 341 float psSpline1DEval(float x, ///< Coordinate at which to evaluate 342 const psSpline1D *spline ///< Spline to evaluate 343 ); 344 345 /** Evaluator: vector version */ 346 psVector *psSpline1DEvalVector(psVector *x, ///< Coordinates at which to evaluate 347 const psSpline1D *spline ///< Spline to evaluate 348 ); 349 226 350 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
