Пример #1
0
 double polygonCellVolume(const Vector<Point>& points,
                          const Point& face_centroid,
                          const Point& cell_centroid)
 {
     double tot_volume = 0.0;
     int num_points = points.size();
     for (int i = 0; i < num_points; ++i) {
         Point tet[4] = { cell_centroid, face_centroid, points[i], points[(i+1)%num_points] };
         double small_volume = std::fabs(simplex_volume(tet));
         assert(small_volume > 0);
         tot_volume += small_volume;
     }
     assert(tot_volume>0);
     return tot_volume;
 }
Пример #2
0
 Point polygonCellCentroid(const Vector<Point>& points,
                           const Point& face_centroid,
                           const Point& cell_centroid)
 {
     Point centroid(0.0);
     double tot_volume = 0.0;
     int num_points = points.size();
     for (int i = 0; i < num_points; ++i) {
         Point tet[4] = { cell_centroid, face_centroid, points[i], points[(i+1)%num_points] };
         double small_volume = std::fabs(simplex_volume(tet));
         assert(small_volume > 0);
         Point small_centroid = tet[0];
         for(int j = 1; j < 4; ++j){
             small_centroid += tet[j];
         }
         small_centroid *= small_volume/4.0;
         centroid += small_centroid;
         tot_volume += small_volume;
     }
     centroid /= tot_volume;
     assert(tot_volume>0);
     return centroid;
 
 }
Пример #3
0
 inline T volume(const Point<T, 3>* c)
 { return simplex_volume(c); }
Пример #4
0
 inline T area(const Point<T, 2>* c)
 { return simplex_volume(c); }