updated to the new temporary data structure

This commit is contained in:
Paolo Cignoni 2008-05-16 17:44:31 +00:00
parent 634b5c4f63
commit 25dd36a704
2 changed files with 14 additions and 36 deletions

View File

@ -23,6 +23,9 @@
/**************************************************************************** /****************************************************************************
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.8 2008/05/14 10:03:29 ganovelli
Point3f->Coordtype
Revision 1.7 2008/04/23 16:37:15 onnis Revision 1.7 2008/04/23 16:37:15 onnis
VertexCurvature method added. VertexCurvature method added.
@ -292,8 +295,8 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer
VertexIterator vi; VertexIterator vi;
typename MeshType::CoordType e01v ,e12v ,e20v; typename MeshType::CoordType e01v ,e12v ,e20v;
SimpleTempData<VertContainer, AreaData> TDAreaPtr(m.vert); TDAreaPtr.Start(); SimpleTempData<VertContainer, AreaData> TDAreaPtr(m.vert); //TDAreaPtr.Start();
SimpleTempData<VertContainer, typename MeshType::CoordType> TDContr(m.vert); TDContr.Start(); SimpleTempData<VertContainer, typename MeshType::CoordType> TDContr(m.vert); //TDContr.Start();
vcg::tri::UpdateNormals<MeshType>::PerVertexNormalized(m); vcg::tri::UpdateNormals<MeshType>::PerVertexNormalized(m);
//Compute AreaMix in H (vale anche per K) //Compute AreaMix in H (vale anche per K)
@ -386,8 +389,8 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer
} }
} }
TDAreaPtr.Stop(); // TDAreaPtr.Stop();
TDContr.Stop(); // TDContr.Stop();
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.30 2008/04/29 11:51:28 corsini
set defaut callback (in save) to null
Revision 1.29 2008/01/24 11:54:23 cignoni Revision 1.29 2008/01/24 11:54:23 cignoni
passed the callback in the save passed the callback in the save
@ -419,14 +422,9 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
VertexPointer vp; VertexPointer vp;
VertexIterator vi; VertexIterator vi;
SimpleTempData<typename SaveMeshType::VertContainer,int> indices(m.vert); SimpleTempData<typename SaveMeshType::VertContainer,int> indices(m.vert);
if(!m.HasPerVertexFlags())
indices.Start();
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi){ for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi){
vp=&(*vi); vp=&(*vi);
if(m.HasPerVertexFlags())
FlagV.push_back(vp->UberFlags()); // Salva in ogni caso flag del vertice
else
indices[j] = j; indices[j] = j;
if( !m.HasPerVertexFlags() || !vp->IsD() ) if( !m.HasPerVertexFlags() || !vp->IsD() )
@ -504,8 +502,6 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
fprintf(fpout,"\n"); fprintf(fpout,"\n");
} }
if(m.HasPerVertexFlags())
vp->UberFlags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!
j++; j++;
} }
} }
@ -525,19 +521,10 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if( ! fp->IsD() ) if( ! fp->IsD() )
{ fcnt++; { fcnt++;
if(binary) if(binary)
{
if(m.HasPerVertexFlags()){
vv[0]=fp->cV(0)->UberFlags();
vv[1]=fp->cV(1)->UberFlags();
vv[2]=fp->cV(2)->UberFlags();
}
else
{ {
vv[0]=indices[fp->cV(0)]; vv[0]=indices[fp->cV(0)];
vv[1]=indices[fp->cV(1)]; vv[1]=indices[fp->cV(1)];
vv[2]=indices[fp->cV(2)]; vv[2]=indices[fp->cV(2)];
}
fwrite(&c,1,1,fpout); fwrite(&c,1,1,fpout);
fwrite(vv,sizeof(int),3,fpout); fwrite(vv,sizeof(int),3,fpout);
@ -610,10 +597,6 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
} }
else // ***** ASCII ***** else // ***** ASCII *****
{ {
if(m.HasPerVertexFlags())
fprintf(fpout,"3 %d %d %d ",
fp->cV(0)->UberFlags(), fp->cV(1)->UberFlags(), fp->cV(2)->UberFlags() );
else
fprintf(fpout,"3 %d %d %d ", fprintf(fpout,"3 %d %d %d ",
indices[fp->cV(0)], indices[fp->cV(1)], indices[fp->cV(2)] ); indices[fp->cV(0)], indices[fp->cV(1)], indices[fp->cV(2)] );
@ -691,14 +674,6 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
} }
assert(fcnt==m.fn); assert(fcnt==m.fn);
fclose(fpout); fclose(fpout);
// Recupera i flag originali
if(m.HasPerVertexFlags())
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
(*vi).UberFlags()=FlagV[j++];
else
indices.Stop();
return 0; return 0;
} }