12  Hexahedron():ext_(DCube::nothing()),vSum_(0.0) {}
 
   13  void addPoint(
const DVect3 &v) 
 
   16    ext_ = ext_.expandToInclude(v);
 
   19  const std::vector<DVect3> &points()
 const { 
return points_; }
 
   20  const DCube               &extent()
 const { 
return ext_; }
 
   22  bool isInConvex(DVect3 
const& point)
 const 
   24    static const int faceGpIndex[6][4]  = {{4,7,3,0} ,  
 
   31    assert(points_.size() == 8);
 
   33    if (ext_.isIn(point)==
false) 
return false;
 
   35    for (
int i = 0; i < 6; ++i) 
 
   37      const DVect3 &v0 = points_[faceGpIndex[i][0]];
 
   38      const DVect3 &v1 = points_[faceGpIndex[i][1]];
 
   39      const DVect3 &v2 = points_[faceGpIndex[i][2]];
 
   41      DVect3 point2face = v0 - point;         
 
   43      const DVect3 &dir1 = v1 - v0;
 
   44      const DVect3 &dir2 = v2 - v0;
 
   45      const DVect3 &nV   = (dir1&dir2).unit(); 
 
   47      const double d = point2face|nV;        
 
   59  bool isRegular()
 const 
   61    assert(points_.size()==8);
 
   62    DVect3 v1 = (points_[0]-points_[4]);
 
   63    DVect3 v2 = (points_[0]-points_[1]);
 
   64    DVect3 v3 = (points_[0]-points_[3]);
 
   67    if (fabs(dotP) > 1e-14) 
return false; 
 
   69    if (fabs(dotP) > 1e-14) 
return false; 
 
   71    if (fabs(dotP) > 1e-14) 
return false; 
 
   75  DVect3 geometricCenter()
 const  
   77    int nPoints = to<int>(points_.size());
 
   78    if (nPoints == 0) 
return DVect3(0.0);
 
   84    assert(points_.size() == 8);
 
   85    DVect3 maxEdges(ext_.width(),ext_.height(),ext_.depth());
 
   90  std::vector<DVect3> points_;