ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/math/AlphaHull.cpp
(Generate patch)

Comparing trunk/src/math/AlphaHull.cpp (file contents):
Revision 1983 by gezelter, Tue Apr 15 20:36:19 2014 UTC vs.
Revision 2056 by gezelter, Fri Feb 20 15:12:07 2015 UTC

# Line 213 | Line 213 | void AlphaHull::computeHull(vector<StuntDouble*> bodyd
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.
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    
# Line 242 | Line 242 | void AlphaHull::computeHull(vector<StuntDouble*> bodyd
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;
# Line 276 | Line 279 | void AlphaHull::computeHull(vector<StuntDouble*> bodyd
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;
# Line 302 | Line 308 | void AlphaHull::computeHull(vector<StuntDouble*> bodyd
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    
# Line 359 | Line 366 | void AlphaHull::computeHull(vector<StuntDouble*> bodyd
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]);
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   /*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines