$search
00001 #ifndef USPLINE_HH 00002 #define USPLINE_HH 00003 /* 00004 James R. Diebel 00005 Stanford University 00006 00007 Started: 22 November 2004 00008 Last revised: 2004 00009 00010 uspline.hh - defines class for cubic spline that approximates 00011 a single-valued function y(x) where our samples over x must be 00012 uniform - thus the 'u' in the 'uspline' 00013 00014 Depends on: 00015 - Matrix inversion routine (matrix.hh) 00016 */ 00017 00018 #include "matrix.hh" 00019 00020 namespace bmtk { 00021 00022 class USpline { 00023 public: 00024 // Data 00025 int n; // number of control points 00026 float **A; // matrix used for coefficient generation 00027 float* y; // vector of control points 00028 float* a; // vector of coefficients, also the y-control points 00029 float* b; 00030 float* c; 00031 float* d; // vector of higher-order coefficients 00032 float b0,bn; // slopes at endpoints 00033 float xmin,xmax; // range of independent coordinate 00034 float span,interval,dpdx; 00035 00036 // Methods 00037 USpline(int n_); 00038 USpline(int n_, float xmin_, float xmax_, float b0_, float bn_); 00039 USpline(float* y_, int n_); 00040 ~USpline(); 00041 00042 // generate spline coefficients, evaluate value of spline 00043 void update(); 00044 float evalf(float x); 00045 float evaldf(float x); 00046 void print(); 00047 }; 00048 00049 } // namespace bmtk 00050 00051 #endif