made compliant to polygon_support

This commit is contained in:
ganovelli 2008-11-12 16:03:24 +00:00
parent c7e86ab57a
commit 122f0412c8
1 changed files with 17 additions and 23 deletions

View File

@ -118,21 +118,16 @@ void SubSet(S_MESH_TYPE & m, STL_CONT & subSet)
for(pfi=subSet.begin(); pfi!=subSet.end(); ++pfi) for(pfi=subSet.begin(); pfi!=subSet.end(); ++pfi)
{ {
assert(!(*pfi)->IsD()); assert(!(*pfi)->IsD());
// m.face.push_back(*(*pfi));
(*fi).ImportLocal(**pfi); (*fi).ImportLocal(**pfi);
(*fi).V(0) = (S_VertexType*)(void*)(*pfi)->V(0); for(int ii = 0 ; ii < (*fi).VN(); ++ii)
(*fi).V(1) = (S_VertexType*)(void*)(*pfi)->V(1); (*fi).V(ii) = (S_VertexType*)(void*)(*pfi)->V(ii);
(*fi).V(2) = (S_VertexType*)(void*)(*pfi)->V(2);
++fi; ++fi;
} }
for(fi=m.face.begin(); fi!=m.face.end(); ++fi) for(fi=m.face.begin(); fi!=m.face.end(); ++fi)
{ for(int ii = 0 ; ii < (*fi).VN(); ++ii)
newVertices.push_back(InsertedV<S_MESH_TYPE>((*fi).V(0), &(*fi),0)); newVertices.push_back(InsertedV<S_MESH_TYPE>((*fi).V(ii), &(*fi),ii));
newVertices.push_back(InsertedV<S_MESH_TYPE>((*fi).V(1), &(*fi),1));
newVertices.push_back(InsertedV<S_MESH_TYPE>((*fi).V(2), &(*fi),2));
}
sort(newVertices.begin(), newVertices.end()); sort(newVertices.begin(), newVertices.end());
@ -151,20 +146,19 @@ void SubSet(S_MESH_TYPE & m, STL_CONT & subSet)
typename std::vector< InsertedV<S_MESH_TYPE> >::iterator newE=unique(newVertices.begin(), newVertices.end()); typename std::vector< InsertedV<S_MESH_TYPE> >::iterator newE=unique(newVertices.begin(), newVertices.end());
vi = vcg::tri::Allocator<S_MESH_TYPE>::AddVertices(m,newE-newVertices.begin()); vi = vcg::tri::Allocator<S_MESH_TYPE>::AddVertices(m,newE-newVertices.begin());
for(curr=newVertices.begin(); curr!=newE; ++curr,++vi) for(curr=newVertices.begin(); curr!=newE; ++curr,++vi)
(*vi).ImportLocal(*((*curr).v)); (*vi).ImportLocal(*((*curr).v));
for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi) for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
redirect.push_back(&(*vi)); redirect.push_back(&(*vi));
for(fi=m.face.begin(); fi!=m.face.end(); ++fi) for(fi=m.face.begin(); fi!=m.face.end(); ++fi)
{ {
(*fi).V(0)=redirect[(size_t)(*fi).V(0)]; for(int ii = 0 ; ii < (*fi).VN(); ++ii)
(*fi).V(1)=redirect[(size_t)(*fi).V(1)]; (*fi).V(ii)=redirect[(size_t)(*fi).V(ii)];
(*fi).V(2)=redirect[(size_t)(*fi).V(2)]; }
} m.vn=(int)m.vert.size();
m.vn=(int)m.vert.size(); m.fn=(int)m.face.size();
m.fn=(int)m.face.size();
} }