133 |
|
localHullSites++; |
134 |
|
|
135 |
|
int idx = qh_pointid(vertex->point); |
136 |
< |
|
136 |
> |
|
137 |
|
indexMap.push_back(idx); |
138 |
|
|
139 |
|
coords.push_back(ptArray[dim_ * idx]); |
212 |
|
qh_setvoronoi_all(); |
213 |
|
|
214 |
|
|
215 |
< |
int convexNumVert = qh_setsize(qh_facetvertices (qh facet_list, NULL, false)); |
216 |
< |
//Insert all the sample points, because, even with alpha=0, the alpha shape/alpha complex will |
217 |
< |
//contain them. |
215 |
> |
// int convexNumVert = qh_setsize(qh_facetvertices (qh facet_list, NULL, false)); |
216 |
> |
//Insert all the sample points, because, even with alpha=0, the |
217 |
> |
//alpha shape/alpha complex will contain them. |
218 |
|
|
219 |
|
// tri::Allocator<CMeshO>::AddVertices(pm.cm,convexNumVert); |
220 |
|
|
242 |
|
FORALLfacet_(qh facet_list) { |
243 |
|
numFacets++; |
244 |
|
if (!facet->upperdelaunay) { |
245 |
< |
//For all facets (that are tetrahedrons)calculate the radius of the empty circumsphere considering |
246 |
< |
//the distance between the circumcenter and a vertex of the facet |
245 |
> |
//For all facets (that are tetrahedrons)calculate the radius of |
246 |
> |
//the empty circumsphere considering the distance between the |
247 |
> |
//circumcenter and a vertex of the facet |
248 |
|
vertexT* vertex = (vertexT *)(facet->vertices->e[0].p); |
249 |
|
double* center = facet->center; |
250 |
|
double radius = qh_pointdist(vertex->point,center,dim_); |
251 |
|
|
252 |
|
if (radius>alpha_) // if the facet is not good consider the ridges |
253 |
|
{ |
254 |
< |
//if calculating the alphashape, unmark the facet ('good' is used as 'marked'). |
254 |
> |
//if calculating the alphashape, unmark the facet ('good' is |
255 |
> |
//used as 'marked'). |
256 |
|
facet->good=false; |
257 |
|
|
258 |
< |
//Compute each ridge (triangle) once and test the cironference radius with alpha |
258 |
> |
//Compute each ridge (triangle) once and test the |
259 |
> |
//cironference radius with alpha |
260 |
|
facet->visitid= qh visit_id; |
261 |
|
qh_makeridges(facet); |
262 |
|
ridgeT *ridge, **ridgep; |
279 |
|
} |
280 |
|
} |
281 |
|
|
282 |
< |
//If calculating the alphashape, mark the facet('good' is used as 'marked'). |
283 |
< |
//This facet will have some triangles hidden by the facet's neighbor. |
282 |
> |
//If calculating the alphashape, mark the facet('good' is |
283 |
> |
//used as 'marked'). This facet will have some triangles |
284 |
> |
//hidden by the facet's neighbor. |
285 |
|
if(goodTriangles==4) |
286 |
|
facet->good=true; |
287 |
|
|
288 |
|
} |
289 |
< |
else //the facet is good. Put all the triangles of the tetrahedron in the mesh |
289 |
> |
else //the facet is good. Put all the triangles of the |
290 |
> |
//tetrahedron in the mesh |
291 |
|
{ |
292 |
|
//Compute each ridge (triangle) once |
293 |
|
facet->visitid= qh visit_id; |
294 |
< |
//If calculating the alphashape, mark the facet('good' is used as 'marked'). |
295 |
< |
//This facet will have some triangles hidden by the facet's neighbor. |
294 |
> |
//If calculating the alphashape, mark the facet('good' is |
295 |
> |
//used as 'marked'). This facet will have some triangles |
296 |
> |
//hidden by the facet's neighbor. |
297 |
|
facet->good=true; |
298 |
|
qh_makeridges(facet); |
299 |
|
ridgeT *ridge, **ridgep; |
308 |
|
} |
309 |
|
//assert(numFacets== qh num_facets); |
310 |
|
|
311 |
< |
//Filter the triangles (only the ones on the boundary of the alpha complex) and build the mesh |
311 |
> |
//Filter the triangles (only the ones on the boundary of the alpha |
312 |
> |
//complex) and build the mesh |
313 |
|
|
314 |
|
int ridgesCount=0; |
315 |
|
|
364 |
|
RealType area = face.getArea(); |
365 |
|
area_ += area; |
366 |
|
Vector3d normal = face.getUnitNormal(); |
367 |
< |
RealType offset = ((0.0-p[0][0])*normal[0] + (0.0-p[0][1])*normal[1] + (0.0-p[0][2])*normal[2]); |
367 |
> |
// RealType offset = ((0.0-p[0][0])*normal[0] + (0.0-p[0][1])*normal[1] + (0.0-p[0][2])*normal[2]); |
368 |
|
RealType dist = normal[0] * interiorPoint[0] + normal[1]*interiorPoint[1] + normal[2]*interiorPoint[2]; |
362 |
– |
cout << "Dist and normal and area are: " << normal << endl; |
369 |
|
volume_ += dist *area/qh hull_dim; |
370 |
|
|
371 |
|
Triangles_.push_back(face); |
372 |
|
} |
373 |
|
} |
374 |
|
|
369 |
– |
cout << "Volume is: " << volume_ << endl; |
375 |
|
|
376 |
|
//assert(pm.cm.fn == ridgesCount); |
377 |
|
/* |