00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef UCB_SPLINE_SURFACE
00032 #define UCB_SPLINE_SURFACE
00033
00034 #include <boost/shared_ptr.hpp>
00035
00036 #include <UCBtypedef.h>
00037 #include <GenMatrix.h>
00038
00039
00040 namespace UCBspl {
00041
00048 class SplineSurface {
00049 typedef GenMatrix<UCBspl_real> GenMatrixType;
00050 boost::shared_ptr<GenMatrixType> PHI_;
00051
00052 double umin_;
00053 double vmin_;
00054 double umax_;
00055 double vmax_;
00056
00057 public:
00058
00059
00063 SplineSurface() {umin_=vmin_=0.0; umax_=vmax_=1.0;}
00064
00068 SplineSurface(boost::shared_ptr<GenMatrixType> PHI,
00069 double umin, double vmin,
00070 double umax, double vmax);
00071
00073 SplineSurface(const SplineSurface& surf);
00074
00075 ~SplineSurface(){}
00076
00077
00079 void init(boost::shared_ptr<GenMatrixType> PHI,
00080 double umin, double vmin,
00081 double umax, double vmax);
00082
00084 void getDomain(double& umin, double& vmin, double& umax, double& vmax) const
00085 {umin = umin_; vmin = vmin_; umax = umax_; vmax = vmax_;}
00086
00087
00088 double umin() const {return umin_;}
00089 double vmin() const {return vmin_;}
00090 double umax() const {return umax_;}
00091 double vmax() const {return vmax_;}
00092
00096 double f(double u, double v) const;
00097
00105 double f(int i, int j) const;
00106
00110 void normalVector(double u, double v, double& gx, double& gy, double& gz) const;
00111
00115 void normalVector(int i, int j, double& gx, double& gy, double& gz) const;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 void derivatives(double u, double v, double& dx, double& dy) const;
00126
00127
00128
00129
00130 void secondDerivatives(double u, double v, double& ddx, double& ddy, double& dxdy) const;
00131
00132
00133
00134
00135 void curvatures(double u, double v, double& profC, double& planC) const;
00136
00142 void eval(double u, double v, double& z, double& gx, double& gy, double& gz) const;
00143
00147 void eval(int i, int j, double& z, double& gx, double& gy, double& gz) const;
00148
00150 const boost::shared_ptr<GenMatrixType> getCoefficients() const {return PHI_;}
00151
00158 void getIndexDomain(int& m, int& n) const {m = PHI_->noX()-3; n = PHI_->noY()-3;}
00159
00166 void refineCoeffs();
00167
00181 bool restrictCoeffs();
00182 };
00183
00184 };
00185
00186 #endif