RBF.h
00001 
00002 #ifndef _RBF_H_
00003 #define _RBF_H_
00004 
00005 #include 
00006 #include
00007 #include 
00008 #include 
00009 
00010 namespace RBF{
00011 
00012 const float     PI = 3.14159265358979323846f;
00013 
00018 template
00019 class TPS2 {
00020  public:
00021 
00030   T operator() (T x, T y, T xj, T yj) {
00031   
00032     T r = sqrt( (x-xj) * (x-xj) + (y-yj) * (y-yj) );  
00033     if (r == 0) return 0;
00034     else return pow(r, 2) * log(r);     
00035   }
00036 };
00037 
00042  template
00043    class TPS4 {
00044    public:
00045 
00053   T operator() (T x, T y, T xj, T yj) {
00054   
00055     T r = sqrt( (x-xj) * (x-xj) + (y-yj) * (y-yj) );  
00056     if (r == 0) return 0;
00057     else return pow(r, 4) * log(r);     
00058   }
00059 };
00060 
00065  template
00066    class MQ{    
00067  public:
00068    T operator() (T x, T y, T xj, T yj,T c) {
00069      return sqrt ( pow((x-xj),2)+pow((y-yj),2)  + c) ;    
00070    }
00071  };
00072 
00076 template
00077 class TPS_2DX {
00078  public:
00079 
00090   T operator() (T x, T y, T xj, T yj) {
00091     T t[15];
00092     
00093     if (x == xj && y == yj )
00094       return 0.0;
00095 
00096     t[0] = 4 * pow((x - xj),2); 
00097         
00098     t[1] = pow(x,2);
00099     t[2] = 2 * x * xj;
00100     t[3] = pow(xj,2);
00101     t[4] = pow(y,2);
00102     t[5] = 2 * y * yj;
00103     t[6] = pow(yj,2);
00104     t[7] = t[1]-t[2]+t[3]+t[4]-t[5]+t[6];
00105     
00106     
00107     if(t[7] == 0)
00108       return 0.0;
00109     else{    
00110       t[8] = log(t[7]);
00111       return t[0]*t[8]+3./2.*t[0]+2.0*t[7]*t[8]+t[1]-t[2]+t[3]+t[4]-t[5]+t[6];            
00112     }  
00113   }  
00114 };    
00115 
00116 
00120 template
00121 class TPS_2DY {
00122  public:
00123 
00134   T operator() (T x, T y, T xj, T yj) {
00135   
00136     T t[15];
00137 
00138     if (x == xj && y == yj )
00139       return 0.0;
00140 
00141     t[0] = 4 * pow((y - yj),2);    
00142     t[1] = pow(x,2);
00143     t[2] = 2 * x * xj;
00144     t[3] = pow(xj,2);
00145     t[4] = pow(y,2);
00146     t[5] = 2 * y * yj;
00147     t[6] = pow(yj,2);
00148     t[7] = t[1]-t[2]+t[3]+t[4]-t[5]+t[6];
00149     
00150     
00151     if(t[7] == 0)
00152       return 0.0;
00153     else{    
00154       t[8] = log(t[7]);
00155       return t[0]*t[8]+3./2.*t[0]+2.0*t[7]*t[8]+t[1]-t[2]+t[3]+t[4]-t[5]+t[6];
00156     }
00157   }
00158                     
00159 };    
00160 
00161 
00168 template
00169 class RHO_PHI{
00170  public:  
00171   T operator() (T x, T y, T xj, T yj, T di) {        
00172     T r = sqrt((x-xj)*(x-xj) + (y-yj)*(y-yj));      
00173     if( r > di)      
00174       return 1./2.*PI*log(r);        
00175     else 
00176       return (1./(4*PI*di*di))*(r*r-di*di)+(1./2.*PI)*log(di);  
00177   }  
00178 };
00179 
00180 
00181 
00182 
00183 
00184 
00185   std::vector  lambdaf;
00186   std::vector  lambdad;
00187 
00188   std::vector  uf;
00189   std::vector  ud;
00190 
00191   std::vector  points2df;
00192   std::vector  points2dd;
00193 
00194   std::vector  points3df;
00195   std::vector  points3dd;
00196 
00197 };
00198 
00199  
00200 #endif // _RBF_H_