Commit 633d41bc authored by Jan Möbius's avatar Jan Möbius

Modified subdivider baseclass to support position update modification.

The algorithms still have to be modified

refs #267



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@519 fdac6126-5c0c-442c-9429-916003d36597
parent 20218b6d
...@@ -143,8 +143,11 @@ protected: ...@@ -143,8 +143,11 @@ protected:
} }
bool subdivide( mesh_t& _m, size_t _n) bool subdivide( mesh_t& _m, size_t _n, const bool _update_positions = true)
{ {
///TODO:Implement fixed positions
typename mesh_t::FaceIter fit, f_end; typename mesh_t::FaceIter fit, f_end;
typename mesh_t::EdgeIter eit, e_end; typename mesh_t::EdgeIter eit, e_end;
typename mesh_t::VertexIter vit; typename mesh_t::VertexIter vit;
...@@ -169,7 +172,7 @@ protected: ...@@ -169,7 +172,7 @@ protected:
// Attention! Creating new edges, hence make sure the loop ends correctly. // Attention! Creating new edges, hence make sure the loop ends correctly.
e_end = _m.edges_end(); e_end = _m.edges_end();
for (eit=_m.edges_begin(); eit != e_end; ++eit) for (eit=_m.edges_begin(); eit != e_end; ++eit)
split_edge(_m, eit.handle() ); split_edge(_m, eit.handle() );
// Commit changes in topology and reconsitute consistency // Commit changes in topology and reconsitute consistency
...@@ -179,7 +182,6 @@ protected: ...@@ -179,7 +182,6 @@ protected:
for (fit = _m.faces_begin(); fit != f_end; ++fit) for (fit = _m.faces_begin(); fit != f_end; ++fit)
split_face(_m, fit.handle() ); split_face(_m, fit.handle() );
// Commit changes in geometry // Commit changes in geometry
for ( vit = _m.vertices_begin(); for ( vit = _m.vertices_begin();
vit != _m.vertices_end(); ++vit) vit != _m.vertices_end(); ++vit)
...@@ -207,7 +209,7 @@ private: ...@@ -207,7 +209,7 @@ private:
using std::cos; using std::cos;
#endif #endif
// 1 // 1
// alpha(n) = ---- * (40 - ( 3 + 2 cos( 2 Pi / n ) ) ) // alpha(n) = ---- * (40 - ( 3 + 2 cos( 2 Pi / n ) ) )
// 64 // 64
if (++valence) if (++valence)
...@@ -395,7 +397,7 @@ private: // geometry helper ...@@ -395,7 +397,7 @@ private: // geometry helper
{ {
typename mesh_t::Point pos(0.0,0.0,0.0); typename mesh_t::Point pos(0.0,0.0,0.0);
if (_m.is_boundary(_vh)) // if boundary: Point 1-6-1 if (_m.is_boundary(_vh) ) // if boundary: Point 1-6-1
{ {
typename mesh_t::HalfedgeHandle heh, prev_heh; typename mesh_t::HalfedgeHandle heh, prev_heh;
heh = _m.halfedge_handle( _vh ); heh = _m.halfedge_handle( _vh );
......
...@@ -174,8 +174,11 @@ protected: ...@@ -174,8 +174,11 @@ protected:
} }
bool subdivide( mesh_t& _m, size_t _n) bool subdivide( MeshType& _m, size_t _n , const bool _update_positions = true)
{ {
///TODO:Implement fixed positions
typename mesh_t::FaceIter fit, f_end; typename mesh_t::FaceIter fit, f_end;
typename mesh_t::EdgeIter eit, e_end; typename mesh_t::EdgeIter eit, e_end;
typename mesh_t::VertexIter vit; typename mesh_t::VertexIter vit;
......
...@@ -191,8 +191,11 @@ protected: ...@@ -191,8 +191,11 @@ protected:
} }
bool subdivide( MeshType& _m, size_t _n ) bool subdivide( MeshType& _m, size_t _n , const bool _update_positions = true)
{ {
///TODO:Implement fixed positions
typename MeshType::VertexIter vit; typename MeshType::VertexIter vit;
typename MeshType::VertexVertexIter vvit; typename MeshType::VertexVertexIter vvit;
typename MeshType::EdgeIter eit; typename MeshType::EdgeIter eit;
......
...@@ -155,9 +155,11 @@ protected: ...@@ -155,9 +155,11 @@ protected:
return true; return true;
} }
bool subdivide( MeshType& _m, size_t _n , const bool _update_positions = true)
bool subdivide( MeshType& _m, size_t _n )
{ {
///TODO:Implement fixed positions
typename MeshType::VertexIter vit; typename MeshType::VertexIter vit;
typename MeshType::VertexVertexIter vvit; typename MeshType::VertexVertexIter vvit;
typename MeshType::EdgeIter eit; typename MeshType::EdgeIter eit;
......
...@@ -118,9 +118,9 @@ public: /// \name Interface 1 ...@@ -118,9 +118,9 @@ public: /// \name Interface 1
//@{ //@{
/// Subdivide the mesh \c _m \c _n times. /// Subdivide the mesh \c _m \c _n times.
/// \see SubdividerT(MeshType&) /// \see SubdividerT(MeshType&)
bool operator () ( MeshType& _m, size_t _n ) bool operator () ( MeshType& _m, size_t _n , const bool _update_positions = true)
{ {
return prepare(_m) && subdivide( _m, _n ) && cleanup( _m ); return prepare(_m) && subdivide( _m, _n , _update_positions ) && cleanup( _m );
} }
//@} //@}
...@@ -144,9 +144,9 @@ public: /// \name Interface 2 ...@@ -144,9 +144,9 @@ public: /// \name Interface 2
/// Subdivide the attached \c _n times. /// Subdivide the attached \c _n times.
/// \see SubdividerT(), attach(), detach() /// \see SubdividerT(), attach(), detach()
bool operator()( size_t _n ) bool operator()( size_t _n , const bool _update_positions = true)
{ {
return attached_ ? subdivide( *attached_, _n ) : false; return attached_ ? subdivide( *attached_, _n , _update_positions) : false;
} }
/// Detach an eventually attached mesh. /// Detach an eventually attached mesh.
...@@ -169,7 +169,7 @@ protected: ...@@ -169,7 +169,7 @@ protected:
virtual bool prepare( MeshType& _m ) = 0; virtual bool prepare( MeshType& _m ) = 0;
/// Subdivide mesh \c _m \c _n times /// Subdivide mesh \c _m \c _n times
virtual bool subdivide( MeshType& _m, size_t _n ) = 0; virtual bool subdivide( MeshType& _m, size_t _n, const bool _update_positions = true) = 0;
/// Cleanup mesh after usage, e.g. remove added properties /// Cleanup mesh after usage, e.g. remove added properties
virtual bool cleanup( MeshType& _m ) = 0; virtual bool cleanup( MeshType& _m ) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment