75 #include "DGtal/base/Common.h"
77 #include "DGtal/geometry/volumes/ConvexityHelper.h"
79 #include "DGtal/shapes/SurfaceMesh.h"
80 #include "DGtal/io/writers/SurfaceMeshWriter.h"
81 #include "ConfigExamples.h"
83 double rand01() {
return (
double) rand() / (double) RAND_MAX; }
85 using namespace DGtal;
87 int main(
int argc,
char* argv[] )
89 int precision = argc > 1 ? atoi( argv[ 1 ] ) : 100;
90 std::string inputFilename = argc > 2
91 ? std::string( argv[ 2 ] )
92 : examplesPath +
"samples/bunny.dat" ;
93 std::vector< RealPoint > points;
94 std::ifstream finput( inputFilename.c_str() );
96 while ( std::getline( finput, linestr ) )
98 std::istringstream iss( linestr );
100 if ( ! (iss >> a >> b >> c) )
break;
101 points.push_back(
RealPoint( a, b, c ) );
103 trace.
info() <<
"Read " << points.size() <<
" 3D points." << std::endl;
108 = Helper::computeRationalPolytope( points, precision );
113 bool ok = Helper::computeConvexHullBoundary( mesh, points, precision );
115 std::ofstream out(
"qhull-mesh.obj" );
121 bool ok2 = Helper::computeConvexHullBoundary( polysurf, points, precision );
126 bool ok3 = Helper::computeConvexHullCellComplex( cvx_complex, points, precision );
127 trace.
info() << cvx_complex << std::endl;
129 return ( ok && ok2 && ok3 ) ? 0 : 1;
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologic...
int main(int argc, char *argv[])
double rand01()
[QuickHull3D-Includes]
Z3i this namespace gathers the standard of types for 3D imagery.
Space::RealPoint RealPoint
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: represents a d-dimensional complex in a d-dimensional space with the following properties and re...
Aim: Provides a set of functions to facilitate the computation of convex hulls and polytopes,...
static bool writeOBJ(std::ostream &output, const SurfaceMesh &smesh)
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...