Commit d77c740b authored by David Bommes's avatar David Bommes
Browse files

re-added CatmullClark without point updates support

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1085 fdac6126-5c0c-442c-9429-916003d36597
parent ff205311
...@@ -113,8 +113,11 @@ CatmullClarkT<MeshType,RealType>::subdivide( MeshType& _m , size_t _n , const bo ...@@ -113,8 +113,11 @@ CatmullClarkT<MeshType,RealType>::subdivide( MeshType& _m , size_t _n , const bo
EdgeIter e_itr = _m.edges_begin(); EdgeIter e_itr = _m.edges_begin();
EdgeIter e_end = _m.edges_end(); EdgeIter e_end = _m.edges_end();
for ( ; e_itr != e_end; ++e_itr) for ( ; e_itr != e_end; ++e_itr)
compute_midpoint( _m, *e_itr ); compute_midpoint( _m, *e_itr, _update_points );
// position updates activated?
if(_update_points)
{
// compute new positions for old vertices // compute new positions for old vertices
VertexIter v_itr = _m.vertices_begin(); VertexIter v_itr = _m.vertices_begin();
VertexIter v_end = _m.vertices_end(); VertexIter v_end = _m.vertices_end();
...@@ -125,6 +128,7 @@ CatmullClarkT<MeshType,RealType>::subdivide( MeshType& _m , size_t _n , const bo ...@@ -125,6 +128,7 @@ CatmullClarkT<MeshType,RealType>::subdivide( MeshType& _m , size_t _n , const bo
v_itr = _m.vertices_begin(); v_itr = _m.vertices_begin();
for ( ; v_itr != v_end; ++v_itr) for ( ; v_itr != v_end; ++v_itr)
_m.set_point(*v_itr, _m.property( vp_pos_, *v_itr ) ); _m.set_point(*v_itr, _m.property( vp_pos_, *v_itr ) );
}
// Split each edge at midpoint stored in edge property ep_pos_; // Split each edge at midpoint stored in edge property ep_pos_;
// Attention! Creating new edges, hence make sure the loop ends correctly. // Attention! Creating new edges, hence make sure the loop ends correctly.
...@@ -283,7 +287,7 @@ CatmullClarkT<MeshType,RealType>::split_edge( MeshType& _m, const EdgeHandle& _e ...@@ -283,7 +287,7 @@ CatmullClarkT<MeshType,RealType>::split_edge( MeshType& _m, const EdgeHandle& _e
template <typename MeshType, typename RealType> template <typename MeshType, typename RealType>
void void
CatmullClarkT<MeshType,RealType>::compute_midpoint( MeshType& _m, const EdgeHandle& _eh) CatmullClarkT<MeshType,RealType>::compute_midpoint( MeshType& _m, const EdgeHandle& _eh, const bool _update_points)
{ {
HalfedgeHandle heh, opp_heh; HalfedgeHandle heh, opp_heh;
...@@ -296,7 +300,7 @@ CatmullClarkT<MeshType,RealType>::compute_midpoint( MeshType& _m, const EdgeHand ...@@ -296,7 +300,7 @@ CatmullClarkT<MeshType,RealType>::compute_midpoint( MeshType& _m, const EdgeHand
// boundary edge: just average vertex positions // boundary edge: just average vertex positions
// this yields the [1/2 1/2] mask // this yields the [1/2 1/2] mask
if (_m.is_boundary(_eh) ) if (_m.is_boundary(_eh) || !_update_points)
{ {
pos *= 0.5; pos *= 0.5;
} }
......
...@@ -144,7 +144,7 @@ private: ...@@ -144,7 +144,7 @@ private:
void split_face( MeshType& _m, const FaceHandle& _fh); void split_face( MeshType& _m, const FaceHandle& _fh);
void compute_midpoint( MeshType& _m, const EdgeHandle& _eh); void compute_midpoint( MeshType& _m, const EdgeHandle& _eh, const bool _update_points);
void update_vertex(MeshType& _m, const VertexHandle& _vh); void update_vertex(MeshType& _m, const VertexHandle& _vh);
......
Supports Markdown
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