Added check with the new end and avoided dangerous updating of already updated pointers

This commit is contained in:
Paolo Cignoni 2006-11-29 15:58:50 +00:00
parent ef0a22c229
commit 5670460684
1 changed files with 9 additions and 2 deletions

View File

@ -24,6 +24,10 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.34 2006/11/28 22:34:28 cignoni
Added default constructor with null initialization to adjacency members.
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
Revision 1.33 2006/11/13 13:12:27 ponchio Revision 1.33 2006/11/13 13:12:27 ponchio
Removed a couple of useless assert. Removed a couple of useless assert.
@ -171,6 +175,7 @@ namespace vcg {
void Clear(){newBase=oldBase=newEnd=oldEnd=0;preventUpdateFlag=false;}; void Clear(){newBase=oldBase=newEnd=oldEnd=0;preventUpdateFlag=false;};
void Update(SimplexPointerType &vp) void Update(SimplexPointerType &vp)
{ {
if(vp>=newBase && vp<newEnd) return;
assert(vp>=oldBase); assert(vp>=oldBase);
assert(vp<oldEnd); assert(vp<oldEnd);
vp=newBase+(vp-oldBase); vp=newBase+(vp-oldBase);
@ -206,7 +211,8 @@ namespace vcg {
m.vn+=n; m.vn+=n;
pu.newBase = &*m.vert.begin(); pu.newBase = &*m.vert.begin();
if(pu.NeedUpdate()) pu.newEnd = &m.vert.back()+1;
if(pu.NeedUpdate())
{ {
FaceIterator fi; FaceIterator fi;
for (fi=m.face.begin(); fi!=m.face.end(); ++fi) for (fi=m.face.begin(); fi!=m.face.end(); ++fi)
@ -280,7 +286,8 @@ namespace vcg {
m.fn+=n; m.fn+=n;
pu.newBase = &*m.face.begin(); pu.newBase = &*m.face.begin();
pu.newEnd = &m.face.back()+1;
if(pu.NeedUpdate()) if(pu.NeedUpdate())
{ {
FaceIterator fi; FaceIterator fi;