#include #include #include extern "C" { #ifdef Q2012 # include # include # include # include # include #else # include # include # include # include # include #endif } using namespace std; int main (void) { // Cube centered at 0.5, 0.5, 0.5 coordT points[24] = {0,0,0, 1,0,0, 1,1,0, 0,1,0, 0,0,1, 1,0,1, 1,1,1, 0,1,1}; const int dim = 3; const int num_points = 8; string options = " Qt FO i"; boolT ismalloc = false; // Replace the 0 pointer with stdout for debugging information. #ifdef Q2009FIX FILE *outfile = fopen ("/dev/null", "w"); #else FILE *outfile = 0; #endif FILE *errfile = stderr; // qh_new_qhull command and points arguments are not const... string cmd = "qhull" + options; char *cmd_str = new char[cmd.length () + 1]; strcpy (cmd_str, cmd.c_str ()); int exitcode = qh_new_qhull (dim, num_points, points, ismalloc, cmd_str, outfile, errfile); if (! exitcode) { int nf = qh num_facets; cout << "Number of facets: " << nf << endl; } }