--- branches/development/src/math/ConvexHull.cpp 2013/04/03 21:32:13 1858 +++ branches/development/src/math/ConvexHull.cpp 2013/05/15 15:09:35 1874 @@ -63,7 +63,7 @@ using namespace std; using namespace OpenMD; using namespace std; -ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull Qt Pp") { +ConvexHull::ConvexHull() : Hull(), dim_(3), options_("qhull FA Qt Pp") { } void ConvexHull::computeHull(vector bodydoubles) { @@ -77,15 +77,12 @@ void ConvexHull::computeHull(vector body setT *vertices; int curlong, totlong; - Vector3d boxMax; - Vector3d boxMin; - vector ptArray(numpoints*dim_); // Copy the positon vector into a points vector for qhull. vector::iterator SD; int i = 0; - + for (SD =bodydoubles.begin(); SD != bodydoubles.end(); ++SD){ Vector3d pos = (*SD)->getPos(); ptArray[dim_ * i] = pos.x(); @@ -207,6 +204,9 @@ void ConvexHull::computeHull(vector body // commented out below, so comment out here also. // intPoint = qh interior_point; // RealType calcvol = 0.0; + + qh_triangulate (); + FORALLfacets { Triangle face; //Qhull sets the unit normal in facet->normal @@ -283,25 +283,6 @@ void ConvexHull::computeHull(vector body qh_getarea(qh facet_list); volume_ = qh totvol; area_ = qh totarea; - - int index = 0; - FORALLvertices { - Vector3d point(vertex->point[0], vertex->point[1], vertex->point[2]); - if (index == 0) { - boxMax = point; - boxMin = point; - } else { - for (int i = 0; i < 3; i++) { - boxMax[i] = max(boxMax[i], point[i]); - boxMin[i] = min(boxMin[i], point[i]); - } - } - index++; - } - boundingBox_ = Mat3x3d(0.0); - boundingBox_(0,0) = boxMax[0] - boxMin[0]; - boundingBox_(1,1) = boxMax[1] - boxMin[1]; - boundingBox_(2,2) = boxMax[2] - boxMin[2]; qh_freeqhull(!qh_ALL); qh_memfreeshort(&curlong, &totlong);