From eb691cb768898b07077704edac3c9cdf5eedb4b7 Mon Sep 17 00:00:00 2001 From: ponchio Date: Sat, 14 Oct 2006 16:20:06 +0000 Subject: [PATCH] *** empty log message *** --- .../trimesh_ball_pivoting/trimesh_ball_pivoting.cpp | 2 +- vcg/complex/trimesh/create/ball_pivoting.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp index ac978dcf..115668af 100644 --- a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp +++ b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp @@ -87,7 +87,7 @@ int main(int argc, char **argv) int t1=clock(); // the main processing - while(pivot.addFace() != -1); + pivot.buildMesh(); int t2=clock(); diff --git a/vcg/complex/trimesh/create/ball_pivoting.h b/vcg/complex/trimesh/create/ball_pivoting.h index b3d252b2..18476bf4 100644 --- a/vcg/complex/trimesh/create/ball_pivoting.h +++ b/vcg/complex/trimesh/create/ball_pivoting.h @@ -85,9 +85,18 @@ Pivot(MESH &_mesh, ScalarType _radius, ScalarType _mindist = 0.05, ScalarType _c nb.resize(mesh.vert.size(), 0); for(int i = 0; i < mesh.vert.size(); i++) mesh.vert[i].ClearFlags(); + srand(time(NULL)); } - + /* ci mettero' anche una callback prima o poi */ +void buildMesh() { + while(addFace() != -1); + for(int i = 0; i < mesh.face.size(); i++) { + CFace &face = mesh.face[i]; + for(int k = 0; k < 3; k++) + face.V(k) = &(mesh.vert[(int)face.V(k)]); + } +} /* select a vertex at random, a small group of nearby vertices and looks for a sphere that touches 3 and contains none.