diff --git a/apps/sample/sample.pro b/apps/sample/sample.pro index 2aed0730..1d3c93e6 100644 --- a/apps/sample/sample.pro +++ b/apps/sample/sample.pro @@ -12,6 +12,7 @@ SUBDIRS = trimesh_base \ trimesh_join \ trimesh_optional \ trimesh_intersection \ + trimesh_ball_pivoting \ aabb_binary_tree \ edgemesh_grid diff --git a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp new file mode 100644 index 00000000..ed8bcb36 --- /dev/null +++ b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.cpp @@ -0,0 +1,98 @@ + +// mesh definition +//#include +//#include +//#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +// input output +#include +#include + +// std +#include +#include + +using namespace vcg; +using namespace std; + +class MyEdge; // dummy prototype never used +class MyFace; +class MyVertex; + +class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f, vert::Normal3f, vert::BitFlags >{}; +class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef, face::Normal3f, face::BitFlags > {}; +class MyMesh : public vcg::tri::TriMesh< vector, vector > {}; + +int main(int argc, char **argv) +{ + if(argc<3) + { + printf( + "\n trimesh_ball_pivoting ("__DATE__")\n" + " Visual Computing Group I.S.T.I. C.N.R.\n" + "Usage: PlyRefine filein.ply fileout.ply [opt] \n" + "options: \n" + "-r radius of the rolling ball\n" + ); + exit(0); + } + + int i=3; + int CellNum=100000; + float CellSize=0; + bool DupFace=false; + + while(i::Open(m,argv[1])!=0) + { + printf("Error reading file %s\n",argv[1]); + exit(0); + } + vcg::tri::UpdateBounding::Box(m); + vcg::tri::UpdateNormals::PerFace(m); + printf("Input mesh vn:%i fn:%i\n",m.vn,m.fn); + + int t0=clock(); + // Initialization + + int t1=clock(); + // the main processing + + int t2=clock(); + + printf("Output mesh vn:%i fn:%i\n",m.vn,m.fn); + printf("Simplified in :%i msec (%i+%i)\n",t2-t0,t1-t0,t2-t1); + + vcg::tri::io::PlyInfo pi; + vcg::tri::io::ExporterPLY::Save(m,argv[2],pi.mask); + return 0; + +} diff --git a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro new file mode 100644 index 00000000..d7d3bad6 --- /dev/null +++ b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro @@ -0,0 +1,13 @@ +###################################################################### +# Automatically generated by qmake (2.00a) ven 24. giu 14:14:20 2005 +###################################################################### +# To solve issue related to slash vs. backslash under cygwin try: +# env MINGW_IN_SHELL=1 qmake -spec win32-g++ + +TARGET = trimesh_ball_pivoting +LIBPATH += +DEPENDPATH += . +INCLUDEPATH += . ../../.. +CONFIG += console stl +TEMPLATE = app +SOURCES += trimesh_ball_pivoting.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file