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

Comparing:
trunk/src/math/AlphaHull.cpp (file contents), Revision 1402 by chuckv, Fri Jan 8 17:15:27 2010 UTC vs.
branches/development/src/math/AlphaHull.cpp (file contents), Revision 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC

# Line 44 | Line 44
44   *
45   *  Created by Charles F. Vardeman II on 11 Dec 2006.
46   *  @author  Charles F. Vardeman II
47 < *  @version $Id: ConvexHull.cpp,v 1.21 2009-11-25 20:02:01 gezelter Exp $
47 > *  @version $Id$
48   *
49   */
50  
# Line 79 | Line 79 | double calculate_circumradius(pointT* p0,pointT* p1,po
79   }
80   double calculate_circumradius(pointT* p0,pointT* p1,pointT* p2, int dim);
81  
82 < AlphaHull::AlphaHull(double alpha) : Hull(), dim_(3), alpha_(alpha), options_("qhull d QJ Tcv ") {
82 > AlphaHull::AlphaHull(double alpha) : Hull(), dim_(3), alpha_(alpha), options_("qhull d QJ Tcv Pp") {
83   }
84  
85   void AlphaHull::computeHull(std::vector<StuntDouble*> bodydoubles) {
# Line 91 | Line 91 | void AlphaHull::computeHull(std::vector<StuntDouble*>
91    
92    vertexT *vertex, **vertexp;
93    facetT *facet, *neighbor;
94 <  setT *vertices;
94 >  setT *vertices, *verticestop, *verticesbottom;
95    int curlong, totlong;
96 +  pointT *interiorPoint;
97    
98    std::vector<double> ptArray(numpoints*dim_);
99  
# Line 243 | Line 244 | void AlphaHull::computeHull(std::vector<StuntDouble*>
244    qh visit_id++;
245    int numFacets=0;
246    std::vector<std::vector <int> > facetlist;
247 +  interiorPoint = qh interior_point;
248    FORALLfacet_(qh facet_list) {
249      numFacets++;
250      if (!facet->upperdelaunay) {
# Line 307 | Line 309 | void AlphaHull::computeHull(std::vector<StuntDouble*>
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
312 +
313 +
314    
315    ridgeT *ridge, **ridgep;
316    FOREACHridge_(set) {
# Line 319 | Line 323 | void AlphaHull::computeHull(std::vector<StuntDouble*>
323        // Vector3d V3dNormal(facet->normal[0], facet->normal[1], facet->normal[2]);
324        //face.setNormal(V3dNormal);
325        
322      // RealType faceArea = qh_facetarea(facet);
323      //face.setArea(faceArea);
326        
327 <      //vertices = qh_facet3vertex(facet);
328 <      
327 <      //coordT *center = qh_getcenter(vertices);
327 >      //coordT *center = qh_getcenter(ridge->vertices);
328 >      //std::cout << "Centers are " << center[0] << "  " <<center[1] << "  " << center[2] << std::endl;
329        //Vector3d V3dCentroid(center[0], center[1], center[2]);
330        //face.setCentroid(V3dCentroid);
331 +
332        
333 <      //Vector3d faceVel = V3Zero;
333 >      Vector3d faceVel = V3Zero;
334        Vector3d p[3];
335 <      //RealType faceMass = 0.0;
335 >      RealType faceMass = 0.0;
336        
337        int ver = 0;
338        std::vector<int> virtexlist;
# Line 343 | Line 345 | void AlphaHull::computeHull(std::vector<StuntDouble*>
345          RealType mass;
346          ver++;
347          virtexlist.push_back(id);
348 <      }
349 <      facetlist.push_back(virtexlist);
348 >        // std::cout << "Ridge: " << ridgesCount << " Vertex " << id << std::endl;
349 >
350 >        vel = bodydoubles[id]->getVel();
351 >        mass = bodydoubles[id]->getMass();
352 >        face.addVertexSD(bodydoubles[id]);
353 >
354  
355 +        faceVel = faceVel + vel;
356 +        faceMass = faceMass + mass;
357 +      } //FOREACH Vertex
358 +      facetlist.push_back(virtexlist);
359 +      face.addVertices(p[0],p[1],p[2]);
360 +      face.setFacetMass(faceMass);
361 +      face.setFacetVelocity(faceVel/3.0);
362 +      
363 +      RealType area = face.getArea();
364 +      area_ += area;
365 +      Vector3d normal = face.getUnitNormal();
366 +      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 dist =  normal[0] * interiorPoint[0] + normal[1]*interiorPoint[1] + normal[2]*interiorPoint[2];
368 +      std::cout << "Dist and normal and area are: " << normal << std::endl;
369 +      volume_ += dist *area/qh hull_dim;
370 +      
371 +      Triangles_.push_back(face);
372      }
373    }
351                
374  
375 < //assert(pm.cm.fn == ridgesCount);
375 >  std::cout << "Volume is: " << volume_ << std::endl;
376  
377 + //assert(pm.cm.fn == ridgesCount);
378 + /*
379    std::cout <<"OFF"<<std::endl;
380    std::cout << bodydoubles.size() << "  " << facetlist.size() << "  " << 3*facetlist.size() << std::endl;
381    for (SD =bodydoubles.begin(); SD != bodydoubles.end(); ++SD){
# Line 370 | Line 394 | void AlphaHull::computeHull(std::vector<StuntDouble*>
394      }
395      std::cout << std::endl;
396    }
397 + */
398  
399  
400  
376
401   /*  
402    FORALLfacets {  
403      Triangle face;
# Line 438 | Line 462 | void AlphaHull::computeHull(std::vector<StuntDouble*>
462  
463    } //FORALLfacets
464   */
465 <  qh_getarea(qh facet_list);
466 <  volume_ = qh totvol;
467 <  area_ = qh totarea;
465 >  // qh_getarea(qh facet_list);
466 >  //volume_ = qh totvol;
467 >  // area_ = qh totarea;
468  
469    qh_freeqhull(!qh_ALL);
470    qh_memfreeshort(&curlong, &totlong);

Comparing:
trunk/src/math/AlphaHull.cpp (property svn:keywords), Revision 1402 by chuckv, Fri Jan 8 17:15:27 2010 UTC vs.
branches/development/src/math/AlphaHull.cpp (property svn:keywords), Revision 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines