added the update of the pointers related to the AddEdges

This commit is contained in:
ganovelli 2008-11-26 17:46:31 +00:00
parent a00abdc73c
commit 4cae6b5107
1 changed files with 29 additions and 12 deletions

View File

@ -172,6 +172,7 @@ Initial commit
#include <string>
#include <set>
#include <assert.h>
#include <vcg/complex/trimesh/base.h>
#include <vcg/container/simple_temporary_data.h>
namespace vcg {
@ -305,7 +306,8 @@ namespace vcg {
for (ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
if(!(*ei).IsD())
{
//update edge to vertex pointers (TODO)
if(HasEVAdjacency (m)) { pu.Update((*ei).V(0));pu.Update((*ei).V(1));}
if(HasHEVAdjacency(m)) pu.Update((*ei).HEVp());
}
// e poiche' lo spazio e' cambiato si ricalcola anche last da zero
@ -370,16 +372,31 @@ namespace vcg {
pu.newEnd = &m.edge.back()+1;
if(pu.NeedUpdate())
{
int ii = 0;
FaceIterator fi;
for (fi=m.face.begin(); fi!=m.face.end(); ++fi)
for (fi=m.face.begin(); fi!=m.face.end(); ++fi){
if(HasFHEAdjacency(m))
pu.Update((*fi).FHEp());
if(!(*fi).IsD())
for(int i=0; i < (*fi).VN(); ++i)
if ((*fi).cFEp(i)!=0) pu.Update((*fi).FEp(i));
EdgeIterator ei;
for (ei=m.edge.begin(); ei!=m.edge.end(); ++ei)
}
VertexIterator vi;
for (vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
if(!(*vi).IsD())
if ((*vi).cVEp()!=0) pu.Update((*vi).VEp());
EdgeIterator ei = m.edge.begin();
while(ii < m.en - n){// cycle on all the faces except the new ones
if(!(*ei).IsD())
{
//update edge to vertex pointers (TODO)
if(HasHENextAdjacency(m)) pu.Update((*ei).HENp());
if(HasHEPrevAdjacency(m)) pu.Update((*ei).HEPp());
if(HasHEOppAdjacency(m)) pu.Update((*ei).HEOp());
++ii;
}
++ei;
}
// e poiche' lo spazio e' cambiato si ricalcola anche last da zero
@ -471,7 +488,7 @@ namespace vcg {
{
int ii = 0;
FaceIterator fi = m.face.begin();
while(ii<m.fn-n) // cycle on all the faces wxcept the new ones
while(ii<m.fn-n) // cycle on all the faces except the new ones
{
if(!(*fi).IsD())
{
@ -543,7 +560,7 @@ namespace vcg {
/** Function to delete an edge from the mesh.
NOTE: THIS FUNCTION ALSO UPDATE en
*/
static void DeleteVertex(MeshType &m, EdgeType &e)
static void DeleteEdge(MeshType &m, EdgeType &e)
{
assert(!e.IsD());
e.SetD();