From ca1ac6323f11b83ac1b43318c7a67c4ea1920cb8 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 21 Jan 2009 16:22:05 +0000 Subject: [PATCH] add absolute distance resampling --- vcg/complex/trimesh/create/resampler.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vcg/complex/trimesh/create/resampler.h b/vcg/complex/trimesh/create/resampler.h index ce9ba755..f3c1b9d8 100644 --- a/vcg/complex/trimesh/create/resampler.h +++ b/vcg/complex/trimesh/create/resampler.h @@ -93,6 +93,7 @@ template bbox= _bbox; @@ -104,6 +105,7 @@ template IsD()); bool retIP; @@ -199,7 +201,7 @@ template 0) posCnt ++; + if(ff.second>0) positiveCnt ++; } - if(posCnt<=MultiSample/2) distSum = -distSum; + if(positiveCnt<=MultiSample/2) distSum = -distSum; return field_value(true, distSum/MultiSample); } @@ -596,7 +598,7 @@ typedef Walker /*< Old_Mesh,New_Mesh>*/ MyWalker; typedef vcg::tri::MarchingCubes MyMarchingCubes; ///resample the mesh using marching cube algorithm ,the accuracy is the dimension of one cell the parameter -static void Resample(Old_Mesh &old_mesh,New_Mesh &new_mesh, Box3f volumeBox, vcg::Point3 accuracy,float max_dist, float thr=0, bool DiscretizeFlag=false, bool MultiSampleFlag=false, vcg::CallBackPos *cb=0 ) +static void Resample(Old_Mesh &old_mesh,New_Mesh &new_mesh, Box3f volumeBox, vcg::Point3 accuracy,float max_dist, float thr=0, bool DiscretizeFlag=false, bool MultiSampleFlag=false, bool AbsDistFlag=false, vcg::CallBackPos *cb=0 ) { ///be sure that the bounding box is updated vcg::tri::UpdateBounding::Box(old_mesh); @@ -607,6 +609,7 @@ static void Resample(Old_Mesh &old_mesh,New_Mesh &new_mesh, Box3f volumeBox, vc walker.offset = - thr; walker.DiscretizeFlag = DiscretizeFlag; walker.MultiSampleFlag = MultiSampleFlag; + walker.AbsDistFlag = AbsDistFlag; MyMarchingCubes mc(new_mesh, walker); walker.BuildMesh(old_mesh,new_mesh,mc,cb); }