8 #ifndef IMPALGEBRA_BOUNDING_BOX_D_H 
    9 #define IMPALGEBRA_BOUNDING_BOX_D_H 
   11 #include <IMP/algebra/algebra_config.h> 
   13 #include "internal/utility.h" 
   16 #include <cereal/access.hpp> 
   18 IMPALGEBRA_BEGIN_NAMESPACE
 
   30     for (
int i = 0; i < D; ++i) {
 
   31       b_[0][i] = std::numeric_limits<double>::max();
 
   32       b_[1][i] = -std::numeric_limits<double>::max();
 
   49 #if defined(IMP_SWIG_WRAPPER) 
   55                            << 
"with a variable dimension bounding box.");
 
   63                              << 
"with a variable dimension bounding box.");
 
   65     for (
unsigned int i = 0; i < d; ++i) {
 
   66       lb[i] = std::numeric_limits<double>::max();
 
   67       ub[i] = -std::numeric_limits<double>::max();
 
   77       for (
unsigned int i = 0; i < lb.get_dimension(); ++i) {
 
   91     for (
unsigned int j = 0; j < points.size(); j++) {
 
   92       operator+=(points[j]);
 
   96   unsigned int get_dimension()
 const { 
return get_corner(0).get_dimension(); }
 
  100     for (
unsigned int i = 0; i < get_dimension(); ++i) {
 
  101       b_[0][i] = std::min(o.
get_corner(0)[i], get_corner(0)[i]);
 
  102       b_[1][i] = std::max(o.
get_corner(1)[i], get_corner(1)[i]);
 
  109     for (
unsigned int i = 0; i < get_dimension(); ++i) {
 
  110       b_[0][i] = std::min(o[i], b_[0][i]);
 
  111       b_[1][i] = std::max(o[i], b_[1][i]);
 
  118     for (
unsigned int i = 0; i < get_dimension(); ++i) {
 
  119       b_[0][i] = b_[0][i] - o;
 
  120       b_[1][i] = b_[1][i] + o;
 
  147     for (
unsigned int i = 0; i < get_dimension(); ++i) {
 
  148       if (o[i] < get_corner(0)[i] || o[i] > get_corner(1)[i]) 
return false;
 
  162   friend class cereal::access;
 
  164   template<
class Archive> 
void serialize(Archive &ar) {
 
  172   for (
unsigned int i = 0; i < bb.get_dimension(); ++i) {
 
  180                               return (g.get_corner(1)[0] - g.get_corner(0)[0]) *
 
  181                                      (g.get_corner(1)[1] - g.get_corner(0)[1]) *
 
  182                                      (g.get_corner(1)[2] - g.get_corner(0)[2]),
 
  187 template <
unsigned int D>
 
  189   return BoundingBoxD<D>(-get_ones_vector_d<D>(), get_ones_vector_d<D>());
 
  200 template <
unsigned int D>
 
  203                          radius * get_ones_vector_d<D>());
 
  219                   "Dimensions of bounding boxes don't match.");
 
  220   for (
unsigned int i = 0; i < a.get_dimension(); ++i) {
 
  237   for (
unsigned int i = 0; i < a.get_dimension(); ++i) {
 
  246   for (
unsigned int i = 0; i < a.get_dimension(); ++i) {
 
  271   for (
unsigned int i = 1; i < a.get_dimension(); ++i) {
 
  292   for (
int i = 0; i < D - 1; ++i) {
 
  299   for (
unsigned int i = 0; i < recurse.size(); ++i) {
 
  301     for (
int j = 0; j < D - 1; ++j) {
 
  302       cur[j] = recurse[i][j];
 
  315   static const IntPair edges[12] = {
 
  316       IntPair(0, 1), IntPair(0, 2), IntPair(0, 4), IntPair(1, 3),
 
  317       IntPair(1, 5), IntPair(2, 3), IntPair(2, 6), IntPair(3, 7),
 
  318       IntPair(4, 5), IntPair(4, 6), IntPair(5, 7), IntPair(6, 7)};
 
  319   static IntPairs ret(edges, edges + 12);
 
  323 IMPALGEBRA_END_NAMESPACE
 
const BoundingBoxD< D > & operator+=(double o)
Grow the bounding box by o on all sizes. 
 
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed. 
 
const VectorD< D > & get_corner(unsigned int i) const 
For 0 return lower corner and for 1, the upper corner. 
 
#define IMP_IF_CHECK(level)
Execute the code block if a certain level checks are on. 
 
const BoundingBoxD< D > operator+(const BoundingBoxD< D > &o) const 
Returning a bounding box containing both. 
 
bool get_contains(const BoundingBoxD &bb) const 
True if the input bounding box is completely contained within this one. 
 
const BoundingBoxD< D > operator+(const O &o) const 
Return a bounding box grown by o on all sides. 
 
Vector< VectorD< D > > get_vertices(const BoundingBoxD< D > &bb)
Return a list of the 2^D bounding points for the bounding box. 
 
double get_maximum_length(const BoundingBoxD< D > &a)
Return the maximum axis aligned extent. 
 
double get_volume(const Cone3D &g)
 
IntPairs get_edges(const BoundingBoxD< 3 > &)
Return the edges of the box as indices into the vertices list. 
 
BoundingBoxD< D > get_union(BoundingBoxD< D > a, const BoundingBoxD< D > &b)
Return the union bounding box. 
 
BoundingBoxD< D > get_cube_d(double radius)
Cube with radius of length radius. 
 
Exception definitions and assertions. 
 
BoundingBoxD(unsigned int d)
Create an empty bounding box. 
 
const BoundingBoxD< D > & operator+=(const BoundingBoxD< D > &o)
Extend the current bounding box to include the other. 
 
VectorD< D > get_ones_vector_kd(unsigned int Di, double v=1)
Return a vector of ones (or another constant) 
 
BoundingBoxD< D > get_intersection(const BoundingBoxD< D > &a, const BoundingBoxD< D > &b)
Return the intersecting bounding box. 
 
const BoundingBoxD< D > & operator+=(const VectorD< D > &o)
Extend the current bounding box to include the point. 
 
bool get_interiors_intersect(const BoundingBoxD< D > &a, const BoundingBoxD< D > &b)
Return true if they intersect. 
 
A Cartesian vector in D-dimensions. 
 
BoundingBoxD()
Create an empty bounding box. 
 
#define IMP_UNUSED(variable)
 
#define IMP_VOLUME_GEOMETRY_METHODS_D(Name, name, area, volume, bounding_box)
Implement the needed namespace methods for a geometry type. 
 
BoundingBoxD<-1 > get_unit_bounding_box_kd(unsigned int d)
Box with radius one. 
 
BoundingBoxD<-1 > get_cube_kd(unsigned int d, double radius)
Cube with radius of length side. 
 
An axis-aligned bounding box. 
 
BoundingBoxD(const Vector< VectorD< D > > &points)
Creating a bounding box from a set of points. 
 
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method. 
 
BoundingBoxD< D > get_unit_bounding_box_d()
Box with radius one. 
 
bool get_contains(const VectorD< D > &o) const 
True if the point o is contained within this bounding box. 
 
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet. 
 
BoundingBoxD(const VectorD< D > &v)
Creating a bounding box containing one point. 
 
BoundingBoxD(const VectorD< D > &lb, const VectorD< D > &ub)
Make from the lower and upper corners.