The Parametric Pseudo-Manifold (PPS) Library 1.0
|
00001 00027 #ifndef PPSFROMPNT_H 00028 #define PPSFROMPNT_H 00029 00030 #include "bezier.h" // pps::Bezier 00031 #include "pps.h" // pps::PPS 00032 00033 #include "surface.h" // dcel::Surface 00034 #include "pntriangle.h" // PNTriangle 00035 00036 #include "vertex_attribute.h" // VertexAttribute 00037 #include "halfedge_attribute.h" // HalfedgeAttribute 00038 #include "face_attribute.h" // FaceAttribute 00039 00054 namespace ppsfrompnt { 00055 00056 using pps::PPS ; 00057 using pps::Bezier ; 00058 00059 00067 class PPSfromPNT : public PPS< 00068 dcel::Surface< 00069 VertexAttribute , 00070 FaceAttribute , 00071 int , 00072 HalfedgeAttribute 00073 > 00074 > 00075 { 00076 public: 00077 // --------------------------------------------------------------- 00078 // 00079 // Type definitions 00080 // 00081 // --------------------------------------------------------------- 00082 00089 typedef dcel::Surface< VertexAttribute , FaceAttribute , int , 00090 HalfedgeAttribute > Surface ; 00091 00092 00093 // --------------------------------------------------------------- 00094 // 00095 // Public methods 00096 // 00097 // --------------------------------------------------------------- 00098 00107 PPSfromPNT( Surface* mesh ) ; 00108 00109 00115 ~PPSfromPNT() 00116 {} 00117 00118 00134 void eval_surface( 00135 Face* face , 00136 double u , 00137 double v , 00138 double w , 00139 double& x , 00140 double& y , 00141 double& z 00142 ) 00143 const ; 00144 00145 00146 private: 00147 00148 // --------------------------------------------------------------- 00149 // 00150 // Private methods 00151 // 00152 // --------------------------------------------------------------- 00153 00161 void build_pnt_surface() ; 00162 00163 00174 void compute_vertex_normal_vector( Vertex* vertex , double& x , 00175 double& y , double& z ) ; 00176 00177 00188 void compute_face_normal_vector( Face* face , double& x , 00189 double& y , double& z ) ; 00190 00191 00192 public: 00193 00194 // --------------------------------------------------------------- 00195 // 00196 // Public methods 00197 // 00198 // --------------------------------------------------------------- 00199 00209 inline bool mesh_has_boundary() const 00210 { 00211 return false ; 00212 } 00213 00214 00224 inline bool mesh_is_simplicial() const 00225 { 00226 return true ; 00227 } 00228 00229 00239 inline unsigned int get_id( Halfedge* h ) const 00240 { 00241 return h->get_attributes().get_pps_id() ; 00242 } 00243 00244 00255 inline Vertex* get_org( Halfedge* h ) const 00256 { 00257 return h->get_origin() ; 00258 } 00259 00260 00272 inline Vertex* get_dst( Halfedge* h ) const 00273 { 00274 return h->get_next()->get_origin() ; 00275 } 00276 00277 00288 inline Edge* get_edge( Halfedge* h ) const 00289 { 00290 return h->get_edge() ; 00291 } 00292 00293 00304 inline Face* get_face( Halfedge* h ) const 00305 { 00306 return h->get_face() ; 00307 } 00308 00309 00322 inline Halfedge* get_prev( Halfedge* h ) const 00323 { 00324 return h->get_prev() ; 00325 } 00326 00327 00340 inline Halfedge* get_next( Halfedge* h ) const 00341 { 00342 return h->get_next() ; 00343 } 00344 00345 00356 inline Halfedge* get_mate( Halfedge* h ) const 00357 { 00358 return h->get_mate() ; 00359 } 00360 00361 00372 inline Halfedge* get_halfedge( Face* face ) const 00373 { 00374 return face->get_halfedge() ; 00375 } 00376 00377 00391 inline Halfedge* get_halfedge( Vertex* vertex ) const 00392 { 00393 return vertex->get_halfedge() ; 00394 } 00395 00396 00408 inline unsigned get_degree( Vertex* vertex ) const 00409 { 00410 return vertex->get_halfedge()->get_attributes().get_origin_vertex_degree() ; 00411 } 00412 00413 00425 inline Bezier* get_shape_function( Vertex* vertex ) const 00426 { 00427 return vertex->get_attributes().get_patch() ; 00428 } 00429 00430 00440 inline void set_shape_function( Vertex* vertex, Bezier* patch ) 00441 { 00442 vertex->get_attributes().set_patch( patch ) ; 00443 } 00444 00445 00455 inline VertexIterator vertices_begin() const 00456 { 00457 return get_mesh()->vertices_begin() ; 00458 } 00459 00460 00474 inline bool is_done( const VertexIterator& iterator ) const 00475 { 00476 return iterator == get_mesh()->vertices_end() ; 00477 } 00478 00479 00489 inline void move_forward( VertexIterator& iterator ) const 00490 { 00491 ++iterator ; 00492 } 00493 00494 00506 inline Vertex* get_vertex( const VertexIterator& iterator ) const 00507 { 00508 return *iterator ; 00509 } 00510 00511 00521 inline EdgeIterator edges_begin() const 00522 { 00523 return get_mesh()->edges_begin() ; 00524 } 00525 00526 00540 inline bool is_done( const EdgeIterator& iterator ) const 00541 { 00542 return iterator == get_mesh()->edges_end() ; 00543 } 00544 00545 00554 inline void move_forward( EdgeIterator& iterator ) const 00555 { 00556 ++iterator ; 00557 } 00558 00559 00571 inline Edge* get_edge( const EdgeIterator& iterator ) const 00572 { 00573 return *iterator ; 00574 } 00575 00576 00586 inline FaceIterator faces_begin() const 00587 { 00588 return get_mesh()->faces_begin() ; 00589 } 00590 00591 00605 inline bool is_done( const FaceIterator& iterator ) const 00606 { 00607 return iterator == get_mesh()->faces_end() ; 00608 } 00609 00610 00619 inline void move_forward( FaceIterator& iterator ) const 00620 { 00621 ++iterator ; 00622 } 00623 00624 00636 inline Face* get_face( const FaceIterator& iterator ) const 00637 { 00638 return *iterator ; 00639 } 00640 00641 } ; 00642 00643 00644 } 00645 //end of group class. 00647 00648 #endif // PPSFROMPNT_H