modified MyVolume::isosurface() to remove sliver triangles, still we have an assert error caused by the FaceProjection + Point2Face...

This commit is contained in:
Paolo Cignoni cignoni 2010-04-27 12:10:16 +00:00
parent 133ea1cfba
commit 046ef0d85d
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,6 @@
#include "balloon.h"
#include "float.h"
#include "math.h"
#include "../filter_plymc/plymc.h"
#include "vcg/complex/trimesh/update/curvature.h"
using namespace vcg;
@ -339,16 +338,6 @@ void Balloon::evolveBalloon(){
//--- Estrai isosurface
vol.isosurface( surf, 0 );
//--- Remove slivers which might crash the whole system (reuses the one defined by plymc)
// Paolo: il parametro perc va dato in funzione della grandezza del voxel se gli dai come
// perc: perc=voxel.side/4 sei safe
surf.vert.EnableVFAdjacency();
surf.face.EnableVFAdjacency();
surf.face.EnableFFAdjacency();
vcg::tri::UpdateTopology<CMeshO>::VertexFace( surf );
vcg::tri::UpdateTopology<CMeshO>::FaceFace( surf );
tri::Simplify( surf, vol.getDelta()/4 );
//--- Clear band for next isosurface, clearing the corresponding computation field
for(unsigned int i=0; i<vol.band.size(); i++){
Point3i& voxi = vol.band[i];

View File

@ -1,5 +1,6 @@
#include "volume.h"
#include "myheap.h" // only required by source
#include "../filter_plymc/plymc.h" // remove bad triangles from marching cubes
using namespace vcg;
/// the array is used to scan a single voxel that contains the triangle in the initialization
@ -233,6 +234,16 @@ void MyVolume::isosurface( CMeshO& mesh, float offset ){
(*vi).P()[2] = ((*vi).P()[2]-padsize) * delta + bbox.min[2];
}
//--- Remove slivers which might crash the whole system (reuses the one defined by plymc)
// Paolo: il parametro perc va dato in funzione della grandezza del voxel se gli dai come
// perc: perc=voxel.side/4 sei safe
mesh.vert.EnableMark();
mesh.vert.EnableVFAdjacency();
mesh.face.EnableVFAdjacency();
tri::UpdateTopology<CMeshO>::VertexFace( mesh );
tri::Simplify( mesh, getDelta()/4 );
// Update surface normals
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFaceNormalized( mesh );
vcg::tri::UpdateFlags<CMeshO>::FaceProjection(mesh); // needed to have more robust face distance tests