77 |
|
setT *vertices; |
78 |
|
int curlong, totlong; |
79 |
|
|
80 |
– |
Vector3d boxMax; |
81 |
– |
Vector3d boxMin; |
82 |
– |
|
80 |
|
vector<double> ptArray(numpoints*dim_); |
81 |
|
|
82 |
|
// Copy the positon vector into a points vector for qhull. |
206 |
|
// RealType calcvol = 0.0; |
207 |
|
|
208 |
|
qh_triangulate (); |
212 |
– |
int num_facets = qh num_facets; |
213 |
– |
int num_vertices = qh num_vertices; |
209 |
|
|
210 |
|
FORALLfacets { |
211 |
|
Triangle face; |
283 |
|
qh_getarea(qh facet_list); |
284 |
|
volume_ = qh totvol; |
285 |
|
area_ = qh totarea; |
291 |
– |
|
292 |
– |
int index = 0; |
293 |
– |
FORALLvertices { |
294 |
– |
Vector3d point(vertex->point[0], vertex->point[1], vertex->point[2]); |
295 |
– |
if (index == 0) { |
296 |
– |
boxMax = point; |
297 |
– |
boxMin = point; |
298 |
– |
} else { |
299 |
– |
for (int i = 0; i < 3; i++) { |
300 |
– |
boxMax[i] = max(boxMax[i], point[i]); |
301 |
– |
boxMin[i] = min(boxMin[i], point[i]); |
302 |
– |
} |
303 |
– |
} |
304 |
– |
index++; |
305 |
– |
} |
306 |
– |
boundingBox_ = Mat3x3d(0.0); |
307 |
– |
boundingBox_(0,0) = boxMax[0] - boxMin[0]; |
308 |
– |
boundingBox_(1,1) = boxMax[1] - boxMin[1]; |
309 |
– |
boundingBox_(2,2) = boxMax[2] - boxMin[2]; |
286 |
|
|
287 |
|
qh_freeqhull(!qh_ALL); |
288 |
|
qh_memfreeshort(&curlong, &totlong); |