mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 11:26:11 +00:00
modified isosurface() to use tri::Simplify( mesh, getDelta()/4 ); It doesn't crash at startup because I compacted the vertex array first, but something is wrong... I simply don't know how to use it well considering it completely lacks of documentation
This commit is contained in:
parent
046ef0d85d
commit
fa733a9b03
@ -67,3 +67,21 @@ vcg::face::PointDistanceBaseFunctor<CMeshO::ScalarType> PDistFunct;
|
||||
nearestF = unifGridFace.GetClosest(PDistFunct,markerFunctor,startPt,dist_upper_bound,dist,closestPt);
|
||||
|
||||
|
||||
|
||||
// ------------- CLEANING -------------
|
||||
if(par.getBool("AutoClean"))
|
||||
{
|
||||
int nullFaces=tri::Clean<CMeshO>::RemoveFaceOutOfRangeArea(m.cm,0);
|
||||
if(nullFaces) Log(GLLogStream::FILTER, "PostSimplification Cleaning: Removed %d null faces", nullFaces);
|
||||
int deldupvert=tri::Clean<CMeshO>::RemoveDuplicateVertex(m.cm);
|
||||
if(deldupvert) Log(GLLogStream::FILTER, "PostSimplification Cleaning: Removed %d duplicated vertices", deldupvert);
|
||||
|
||||
int delvert=tri::Clean<CMeshO>::RemoveUnreferencedVertex(m.cm);
|
||||
if(delvert) Log(GLLogStream::FILTER, "PostSimplification Cleaning: Removed %d unreferenced vertices",delvert);
|
||||
m.clearDataMask(MeshModel::MM_FACEFACETOPO | MeshModel::MM_FACEFLAGBORDER);
|
||||
tri::Allocator<CMeshO>::CompactVertexVector(m.cm);
|
||||
tri::Allocator<CMeshO>::CompactFaceVector(m.cm);
|
||||
}
|
||||
|
||||
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm);
|
||||
tri::UpdateBounding<CMeshO>::Box(m.cm);
|
||||
|
||||
@ -234,7 +234,6 @@ 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
|
||||
@ -243,16 +242,16 @@ void MyVolume::isosurface( CMeshO& mesh, float offset ){
|
||||
mesh.face.EnableVFAdjacency();
|
||||
tri::UpdateTopology<CMeshO>::VertexFace( mesh );
|
||||
tri::Simplify( mesh, getDelta()/4 );
|
||||
// tri::Simplify( mesh, getDelta()/16 );
|
||||
|
||||
// Update surface normals
|
||||
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFaceNormalized( mesh );
|
||||
vcg::tri::UpdateFlags<CMeshO>::FaceProjection(mesh); // needed to have more robust face distance tests
|
||||
//--- The simplify operation removed some vertices
|
||||
tri::Allocator<CMeshO>::CompactVertexVector( mesh );
|
||||
tri::Allocator<CMeshO>::CompactFaceVector( mesh );
|
||||
|
||||
// DEBUG: Update bounding box and print out center
|
||||
// vcg::tri::UpdateBounding<CMeshO>::Box(mesh);
|
||||
// Check whether we are at right position
|
||||
// Point3f center = mesh.bbox.Center();
|
||||
// qDebug() << "Isosurface center: " << center[0] << " " << center[1] << " " << center[2] << endl;
|
||||
//--- Update surface normals
|
||||
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFaceNormalized( mesh );
|
||||
//--- Face orientation, needed to have more robust face distance tests
|
||||
tri::UpdateFlags<CMeshO>::FaceProjection(mesh);
|
||||
}
|
||||
|
||||
/// gridaccell is needed only to retrieve the correct face=>voxel index
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user