From 951c94fa2063ceced90bb7df572690eeffbebf56 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Wed, 12 Apr 2017 08:06:58 +0200 Subject: [PATCH] Corrected comment and typo in include --- .../trimesh_intersection_mesh.cpp | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/apps/sample/trimesh_intersection_mesh/trimesh_intersection_mesh.cpp b/apps/sample/trimesh_intersection_mesh/trimesh_intersection_mesh.cpp index 3c4855c5..e60e7f10 100644 --- a/apps/sample/trimesh_intersection_mesh/trimesh_intersection_mesh.cpp +++ b/apps/sample/trimesh_intersection_mesh/trimesh_intersection_mesh.cpp @@ -20,12 +20,10 @@ * for more details. * * * ****************************************************************************/ -/*! \file trimesh_intersection_plane.cpp +/*! \file trimesh_intersection_mesh.cpp \ingroup code_sample -\brief An example of computing the intersection of a mesh with a plane, -saving this polyline as a well projected 2D SVG -and splicing the mesh in the two components below and over the plane +\brief An example of adaptively remeshing the intersection between a cube and a sphere */ @@ -33,7 +31,7 @@ and splicing the mesh in the two components below and over the plane #include #include #include -#include +#include #include #include @@ -63,26 +61,26 @@ int main(int ,char **) printf("Created a sphere mesh of %i vertices %i edges\n",m1.VN(),m1.FN()); printf("Created a cube mesh of %i vertices %i edges\n",m2.VN(),m2.FN()); - math::MarsenneTwisterRNG rnd; + math::MarsenneTwisterRNG rnd(clock()); Point3f direction = vcg::math::GeneratePointOnUnitSphereUniform(rnd); tri::UpdatePosition::Translate(m1,direction); - for(int i=0;i<10;++i) + for(int i=0;i<6;++i) { - tri::Clean::SelectIntersectingFaces(m1,m2); - tri::UpdateSelection::FaceDilate(m1); - tri::Clean::SelectIntersectingFaces(m2,m1); - tri::UpdateSelection::FaceDilate(m2); - IsotropicRemeshing::Params params; - - float len = (tri::Stat::ComputeFaceEdgeLengthAverage(m1,true) + tri::Stat::ComputeFaceEdgeLengthAverage(m1,true)); - params.SetTargetLen(len); - params.SetFeatureAngleDeg(10); - params.iter=3; - params.selectedOnly=true; - printf(" Input mesh %8i v %8i f\n",m1.VN(),m1.FN()); - IsotropicRemeshing::Do(m1, params); - IsotropicRemeshing::Do(m2, params); - printf(" Input mesh %8i v %8i f\n",m1.VN(),m1.FN()); + tri::Clean::SelectIntersectingFaces(m1,m2); + tri::UpdateSelection::FaceDilate(m1); + tri::Clean::SelectIntersectingFaces(m2,m1); + tri::UpdateSelection::FaceDilate(m2); + IsotropicRemeshing::Params params; + + float len = (tri::Stat::ComputeFaceEdgeLengthAverage(m1,true) + tri::Stat::ComputeFaceEdgeLengthAverage(m1,true)); + params.SetTargetLen(len*0.8f); + params.SetFeatureAngleDeg(10); + params.iter=1; // just one iteration to avoid overtessellating. + params.selectedOnly=true; + printf(" Input mesh %8i v %8i f\n",m1.VN(),m1.FN()); + IsotropicRemeshing::Do(m1, params); + IsotropicRemeshing::Do(m2, params); + printf(" Input mesh %8i v %8i f\n",m1.VN(),m1.FN()); } tri::Clean::SelectIntersectingFaces(m1,m2); tri::Clean::SelectIntersectingFaces(m2,m1);