21 #include "libmesh/bounding_box.h" 
   32   return min <= check && check <= max;
 
   38   const Real & my_min_x = this->first(0);
 
   39   const Real & my_max_x = this->second(0);
 
   40   const Real & other_min_x = other_box.first(0);
 
   41   const Real & other_max_x = other_box.second(0);
 
   43   const bool x_int = 
is_between(my_min_x, other_min_x, my_max_x) || 
is_between(my_min_x, other_max_x, my_max_x) ||
 
   44     is_between(other_min_x, my_min_x, other_max_x) || 
is_between(other_min_x, my_max_x, other_max_x);
 
   46   bool intersection_true = x_int;
 
   49   const Real & my_min_y = this->first(1);
 
   50   const Real & my_max_y = this->second(1);
 
   51   const Real & other_min_y = other_box.first(1);
 
   52   const Real & other_max_y = other_box.second(1);
 
   54   const bool y_int = 
is_between(my_min_y, other_min_y, my_max_y) || 
is_between(my_min_y, other_max_y, my_max_y) ||
 
   55     is_between(other_min_y, my_min_y, other_max_y) || 
is_between(other_min_y, my_max_y, other_max_y);
 
   57   intersection_true = intersection_true && y_int;
 
   61   const Real & my_min_z = this->first(2);
 
   62   const Real & my_max_z = this->second(2);
 
   63   const Real & other_min_z = other_box.first(2);
 
   64   const Real & other_max_z = other_box.second(2);
 
   66   const bool z_int = 
is_between(my_min_z, other_min_z, my_max_z) || 
is_between(my_min_z, other_max_z, my_max_z) ||
 
   67     is_between(other_min_z, my_min_z, other_max_z) || 
is_between(other_min_z, my_max_z, other_max_z);
 
   69   intersection_true = intersection_true && z_int;
 
   72   return intersection_true;
 
   83   const Real & my_min_x = this->first(0);
 
   84   const Real & my_max_x = this->second(0);
 
   85   const Real & ot_min_x = other_box.first(0);
 
   86   const Real & ot_max_x = other_box.second(0);
 
   89     is_between(my_min_x - abstol, ot_min_x, my_max_x + abstol) ||
 
   90     is_between(my_min_x - abstol, ot_max_x, my_max_x + abstol) ||
 
   91     is_between(ot_min_x - abstol, my_min_x, ot_max_x + abstol) ||
 
   92     is_between(ot_min_x - abstol, my_max_x, ot_max_x + abstol);
 
   94   bool intersection_true = x_int;
 
   96   if (!intersection_true)
 
  100   const Real & my_min_y = this->first(1);
 
  101   const Real & my_max_y = this->second(1);
 
  102   const Real & ot_min_y = other_box.first(1);
 
  103   const Real & ot_max_y = other_box.second(1);
 
  106     is_between(my_min_y - abstol, ot_min_y, my_max_y + abstol) ||
 
  107     is_between(my_min_y - abstol, ot_max_y, my_max_y + abstol) ||
 
  108     is_between(ot_min_y - abstol, my_min_y, ot_max_y + abstol) ||
 
  109     is_between(ot_min_y - abstol, my_max_y, ot_max_y + abstol);
 
  111   intersection_true = intersection_true && y_int;
 
  113   if (!intersection_true)
 
  118   const Real & my_min_z = this->first(2);
 
  119   const Real & my_max_z = this->second(2);
 
  120   const Real & ot_min_z = other_box.first(2);
 
  121   const Real & ot_max_z = other_box.second(2);
 
  124     is_between(my_min_z - abstol, ot_min_z, my_max_z + abstol) ||
 
  125     is_between(my_min_z - abstol, ot_max_z, my_max_z + abstol) ||
 
  126     is_between(ot_min_z - abstol, my_min_z, ot_max_z + abstol) ||
 
  127     is_between(ot_min_z - abstol, my_max_z, ot_max_z + abstol);
 
  129   intersection_true = intersection_true && z_int;
 
  132   return intersection_true;
 
  138   Real my_min_x = this->first(0);
 
  139   Real my_max_x = this->second(0);
 
  140   bool x_int = 
is_between(my_min_x, p(0), my_max_x);
 
  142   bool intersection_true = x_int;
 
  145   Real my_min_y = this->first(1);
 
  146   Real my_max_y = this->second(1);
 
  147   bool y_int = 
is_between(my_min_y, p(1), my_max_y);
 
  149   intersection_true = intersection_true && y_int;
 
  154   Real my_min_z = this->first(2);
 
  155   Real my_max_z = this->second(2);
 
  156   bool z_int = 
is_between(my_min_z, p(2), my_max_z);
 
  158   intersection_true = intersection_true && z_int;
 
  161   return intersection_true;
 
  167   this->first(0)  = std::max(this->first(0),  other_box.first(0));
 
  168   this->second(0) = std::min(this->second(0), other_box.second(0));
 
  171   this->first(1)  = std::max(this->first(1),  other_box.first(1));
 
  172   this->second(1) = std::min(this->second(1), other_box.second(1));
 
  176   this->first(2)  = std::max(this->first(2),  other_box.first(2));
 
  177   this->second(2) = std::min(this->second(2), other_box.second(2));
 
  184   this->first(0)  = std::min(this->first(0),  other_box.first(0));
 
  185   this->second(0) = std::max(this->second(0), other_box.second(0));
 
  188   this->first(1)  = std::min(this->first(1),  other_box.first(1));
 
  189   this->second(1) = std::max(this->second(1), other_box.second(1));
 
  193   this->first(2)  = std::min(this->first(2),  other_box.first(2));
 
  194   this->second(2) = std::max(this->second(2), other_box.second(2));
 
  207       Real min_dist = std::numeric_limits<Real>::max();
 
  209       for (
unsigned int dir=0; dir<LIBMESH_DIM; ++dir)
 
  211           min_dist = std::min(min_dist, 
std::abs(p(dir) - second(dir)));
 
  212           min_dist = std::min(min_dist, 
std::abs(p(dir) - first(dir)));
 
  219       Real dx[3] = {0., 0., 0.};
 
  224       for (
unsigned int dir=0; dir<LIBMESH_DIM; ++dir)
 
  226           if (p(dir) > second(dir))
 
  227             dx[dir] = p(dir) - second(dir);
 
  228           else if (p(dir) < first(dir))
 
  229             dx[dir] = p(dir) - first(dir);
 
  232       return std::sqrt(dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]);