simple comments and re-indentation for better reading

This commit is contained in:
Paolo Cignoni 2012-11-10 14:36:54 +00:00
parent a1e4341c98
commit 2a21d5fb8e
1 changed files with 44 additions and 45 deletions

View File

@ -175,56 +175,55 @@ public:
*/ */
static VertexIterator AddVertices(MeshType &m,int n, PointerUpdater<VertexPointer> &pu) static VertexIterator AddVertices(MeshType &m,int n, PointerUpdater<VertexPointer> &pu)
{ {
VertexIterator last; VertexIterator last;
if(n == 0) return m.vert.end(); if(n == 0) return m.vert.end();
pu.Clear(); pu.Clear();
if(m.vert.empty()) pu.oldBase=0; // if the vector is empty we cannot find the last valid element if(m.vert.empty()) pu.oldBase=0; // if the vector is empty we cannot find the last valid element
else { else {
pu.oldBase=&*m.vert.begin(); pu.oldBase=&*m.vert.begin();
pu.oldEnd=&m.vert.back()+1; pu.oldEnd=&m.vert.back()+1;
} }
m.vert.resize(m.vert.size()+n); m.vert.resize(m.vert.size()+n);
m.vn+=n; m.vn+=n;
typename std::set<PointerToAttribute>::iterator ai; typename std::set<PointerToAttribute>::iterator ai;
for(ai = m.vert_attr.begin(); ai != m.vert_attr.end(); ++ai) for(ai = m.vert_attr.begin(); ai != m.vert_attr.end(); ++ai)
((PointerToAttribute)(*ai)).Resize(m.vert.size()); ((PointerToAttribute)(*ai)).Resize(m.vert.size());
pu.newBase = &*m.vert.begin(); pu.newBase = &*m.vert.begin();
pu.newEnd = &m.vert.back()+1; pu.newEnd = &m.vert.back()+1;
if(pu.NeedUpdate()) if(pu.NeedUpdate())
{
for (FaceIterator fi=m.face.begin(); fi!=m.face.end(); ++fi)
if(!(*fi).IsD())
for(int i=0; i < (*fi).VN(); ++i)
if ((*fi).cV(i)!=0) pu.Update((*fi).V(i));
for (EdgeIterator ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
if(!(*ei).IsD())
{
if(HasEVAdjacency (m)) { pu.Update((*ei).V(0)); pu.Update((*ei).V(1));}
// if(HasEVAdjacency(m)) pu.Update((*ei).EVp());
}
HEdgeIterator hi;
for (hi=m.hedge.begin(); hi!=m.hedge.end(); ++hi)
if(!(*hi).IsD())
{
if(HasHVAdjacency (m))
{ {
FaceIterator fi; pu.Update((*hi).HVp());
for (fi=m.face.begin(); fi!=m.face.end(); ++fi) }
if(!(*fi).IsD()) }
for(int i=0; i < (*fi).VN(); ++i)
if ((*fi).cV(i)!=0) pu.Update((*fi).V(i));
EdgeIterator ei;
for (ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
if(!(*ei).IsD())
{
if(HasEVAdjacency (m)) { pu.Update((*ei).V(0));pu.Update((*ei).V(1));}
// if(HasEVAdjacency(m)) pu.Update((*ei).EVp());
}
HEdgeIterator hi;
for (hi=m.hedge.begin(); hi!=m.hedge.end(); ++hi)
if(!(*hi).IsD())
{
if(HasHVAdjacency (m))
{
pu.Update((*hi).HVp());
}
}
// e poiche' lo spazio e' cambiato si ricalcola anche last da zero // e poiche' lo spazio e' cambiato si ricalcola anche last da zero
} }
unsigned int siz=(unsigned int)m.vert.size()-n; unsigned int siz=(unsigned int)m.vert.size()-n;
last = m.vert.begin(); last = m.vert.begin();
advance(last,siz); advance(last,siz);
return last;// deve restituire l'iteratore alla prima faccia aggiunta; return last;// deve restituire l'iteratore alla prima faccia aggiunta;
} }
/** \brief Wrapper to AddVertices(); no PointerUpdater /** \brief Wrapper to AddVertices(); no PointerUpdater