The Parametric Pseudo-Manifold (PPS) Library 1.0
|
00001 00025 #ifndef BEZIER_H 00026 #define BEZIER_H 00027 00028 #include <vector> // std::vector 00029 #include <cassert> // assert 00030 00031 00046 namespace pps { 00047 00055 class Bezier { 00056 public: 00057 // --------------------------------------------------------------- 00058 // 00059 // Public methods 00060 // 00061 // --------------------------------------------------------------- 00062 00092 Bezier( 00093 double* param_pts , 00094 double* image_pts , 00095 unsigned np , 00096 unsigned m , 00097 unsigned n , 00098 double rx , 00099 double sx , 00100 double ry , 00101 double sy 00102 ) ; 00103 00104 00113 Bezier( const Bezier& bz ) ; 00114 00115 00121 ~Bezier() ; 00122 00123 00131 inline unsigned get_bidegree_1st_index() const 00132 { 00133 return _m ; 00134 } 00135 00136 00144 inline unsigned get_bidegree_2nd_index() const 00145 { 00146 return _n ; 00147 } 00148 00149 00160 inline double get_aff_1st_point_x_coord() const 00161 { 00162 return _rx ; 00163 } 00164 00165 00176 inline double get_aff_1st_point_y_coord() const 00177 { 00178 return _ry ; 00179 } 00180 00181 00192 inline double get_aff_2nd_point_x_coord() const 00193 { 00194 return _sx ; 00195 } 00196 00197 00208 inline double get_aff_2nd_point_y_coord() const 00209 { 00210 return _sy ; 00211 } 00212 00213 00226 void b( unsigned i , unsigned j , double& x , double& y , double& z ) 00227 const ; 00228 00229 00241 void point( double , double , double& x , double& y , double& z ) const ; 00242 00243 00244 private: 00245 // --------------------------------------------------------------- 00246 // 00247 // Private methods 00248 // 00249 // --------------------------------------------------------------- 00250 00251 00261 inline void set_bidegree_1st_index( unsigned m ) 00262 { 00263 assert( m > 0 ) ; 00264 00265 _m = m ; 00266 } 00267 00268 00278 inline void set_bidegree_2nd_index( unsigned n ) 00279 { 00280 assert( n > 0 ) ; 00281 00282 _n = n ; 00283 } 00284 00285 00297 inline void set_aff_1st_point_x_coord( double rx ) 00298 { 00299 _rx = rx ; 00300 } 00301 00302 00314 inline void set_aff_1st_point_y_coord( double ry ) 00315 { 00316 _ry = ry ; 00317 } 00318 00319 00331 inline void set_aff_2nd_point_x_coord( double sx ) 00332 { 00333 _sx = sx ; 00334 } 00335 00336 00348 inline void set_aff_2nd_point_y_coord( double sy ) 00349 { 00350 _sy = sy ; 00351 } 00352 00353 00364 inline unsigned index( unsigned i , unsigned j ) const 00365 { 00366 return ( i * ( _m + 1 ) ) + j ; 00367 } 00368 00369 00384 double bernstein( unsigned , unsigned , double ) const ; 00385 00386 00399 void all_bernstein( unsigned n , double u , std::vector< double >& b ) const ; 00400 00401 00418 void comp_bpoly_matrix( double**& a , double* param_pts , unsigned np ) const ; 00419 00420 00433 void comp_matrix_ata( double** a , unsigned n , unsigned p , double**& ata ) 00434 const ; 00435 00436 00451 void comp_matrix_atb( double** a , double* b , unsigned n , unsigned p , double**& atb ) const ; 00452 00453 00454 // --------------------------------------------------------------- 00455 // 00456 // Private data members 00457 // 00458 // --------------------------------------------------------------- 00459 00463 unsigned _m ; 00464 unsigned _n ; 00465 00466 00471 double _rx ; 00472 double _sx ; 00473 double _ry ; 00474 double _sy ; 00475 00479 double** _ctrl_pts ; 00480 00481 } ; 00482 00483 } 00484 //end of group class. 00486 00487 #endif // BEZIER_H