61int main(
int argc,
char* argv[] )
63 int nb = argc > 1 ? atoi( argv[ 1 ] ) : 100;
64 double dR = argc > 2 ? atof( argv[ 2 ] ) : 10.0;
71 std::vector< Point > V;
72 const double R2 = dR * dR;
73 const int R = (int) ceil( dR );
74 for (
int i = 0; i < nb; ) {
75 Point p( rand() % (2*R+1) - R, rand() % (2*R+1) - R, rand() % (2*R+1) - R );
76 if ( p.squaredNorm() < R2 ) { V.push_back( p ); i++; }
82 hull.computeConvexHull();
83 std::cout <<
"#points=" << hull.nbPoints()
84 <<
" #vertices=" << hull.nbVertices()
85 <<
" #facets=" << hull.nbFacets() << std::endl;
88 double total_time = 0;
89 std::for_each( hull.timings.cbegin(), hull.timings.cend(),
90 [&total_time] (
double t ) { total_time += t; } );
91 std::cout <<
"purge duplicates= " << round(hull.timings[ 0 ]) <<
" ms." << std::endl;
92 std::cout <<
"init simplex = " << round(hull.timings[ 1 ]) <<
" ms." << std::endl;
93 std::cout <<
"quickhull core = " << round(hull.timings[ 2 ]) <<
" ms." << std::endl;
94 std::cout <<
"compute vertices= " << round(hull.timings[ 3 ]) <<
" ms." << std::endl;
95 std::cout <<
"total time = " << round(total_time) <<
" ms." << std::endl;
99 std::vector< RealPoint > positions;
100 hull.getVertexPositions( positions );
101 std::vector< std::vector< std::size_t > > facets;
102 hull.getFacetVertices( facets );
104 facets.resize( hull.nbFiniteFacets() );
108 std::vector< Z3::RealPoint > positions3d;
109 for (
auto p : positions )
110 positions3d.push_back( Z3::RealPoint( p[ 0 ], p[ 1 ], 0.0 ) );
112 SMesh mesh( positions3d.cbegin(), positions3d.cend(),
113 facets.cbegin(), facets.cend() );
117 std::ofstream out(
"delaunay.obj" );