template<unsigned int dim, typename T>
class Box< dim, T >
This class represent an N-dimensional box.
The box is defined by two points p2 and p1
+---------+ p2
| |
| |
| |
| |
| |
p1 +---------+- Template Parameters
-
| dim | dimensionality of the Box |
| T | type of space ... double float int size_t |
Expand the box with some spacing
float spacing[2] = {0.1,0.1};
BOOST_REQUIRE_CLOSE(sp.getLow(0),1.0,0.0001);
BOOST_REQUIRE_CLOSE(sp.getLow(1),1.0,0.0001);
BOOST_REQUIRE_CLOSE(sp.getHigh(0),2.1,0.0001);
BOOST_REQUIRE_CLOSE(sp.getHigh(1),3.1,0.0001);
Create an enclosing box
BOOST_REQUIRE_EQUAL(box1.getLow(0),0.1f);
BOOST_REQUIRE_EQUAL(box1.getLow(1),0.2f);
BOOST_REQUIRE_EQUAL(box1.getLow(2),0.3f);
BOOST_REQUIRE_EQUAL(box1.getHigh(0),2.0f);
BOOST_REQUIRE_EQUAL(box1.getHigh(1),2.1f);
BOOST_REQUIRE_EQUAL(box1.getHigh(2),2.2f);
Create the smallest boxes between several boxes
box1.contained(box3);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),1.0f,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),0.1f,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),1.0f,0.0001);
Enlarge the box
BOOST_REQUIRE_CLOSE(box1.getLow(0),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(1),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(2),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),1.5,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),1.7,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),2.0,0.0001);
Enlarge the box with fixed P1
BOOST_REQUIRE_CLOSE(box1.getLow(0),0.1,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(1),0.2,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(2),0.3,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),2.0,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),2.3,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),2.7,0.0001);
- See Also
- SpaceBox
Definition at line 56 of file Box.hpp.
|
| bool | Intersect (const Box< dim, T > &b, Box< dim, T > &b_out) const |
| | Intersect. More...
|
| |
| template<typename Mem > |
| bool | Intersect (const encapc< 1, Box< dim, T >, Mem > &e_b, Box< dim, T > &b_out) const |
| | Intersect. More...
|
| |
| template<typename distance > |
| bool | Intersect (Sphere< dim, T > &sphere) |
| | Check if the sphere intersect the box. More...
|
| |
| template<unsigned int b> |
| T | getBase (const unsigned int i) const |
| | Get the coordinate of the bounding point. More...
|
| |
| Box< dim-1, T > | getSubBox () |
| | Get the the box of dimensionality dim-1 (it eliminate the last dimension) More...
|
| |
| Box< dim, T > & | operator= (const Box< dim, T > &box) |
| | Operator= between boxes. More...
|
| |
|
| Box () |
| | default constructor
|
| |
| | Box (const Point< dim, T > &p1, const Point< dim, T > &p2) |
| | Constructor from two points. More...
|
| |
| | Box (std::initializer_list< T > p1, std::initializer_list< T > p2) |
| | Constructor from initializer list. More...
|
| |
| | Box (T *low, T *high) |
| | Box constructor from a box. More...
|
| |
| | Box (const Box< dim, T > &box) |
| | Box constructor from a box. More...
|
| |
| | Box (type box_data) |
| | Box constructor from vector::fusion. More...
|
| |
| | Box (T(&box_data)[dim]) |
| | Box constructor from an array reference. More...
|
| |
| | Box (const grid_key_dx< dim > &key1, const grid_key_dx< dim > &key2) |
| | constructor from 2 grid_key_dx More...
|
| |
| template<unsigned int dimS> |
| | Box (boost::fusion::vector< T[dimS], T[dimS]> &box_data) |
| | Box constructor from vector::fusion of higher dimension. More...
|
| |
| template<typename Mem > |
| | Box (const encapc< 1, Box< dim, T >, Mem > &b) |
| | Box constructor from encapsulated box. More...
|
| |
| template<typename S > |
| | Box (const Box< dim, S > &b) |
| | constructor from a Box of different type More...
|
| |
| Box< dim, T > & | operator/= (const Point< dim, T > &p) |
| | Divide component wise each box points with a point. More...
|
| |
| Box< dim, T > | operator* (const Point< dim, T > &p) |
| | Multiply component wise each box points with a point. More...
|
| |
| void | set (std::initializer_list< T > p1, std::initializer_list< T > p2) |
| | Constructor from initializer list. More...
|
| |
| void | setLow (int i, T val) |
| | set the low interval of the box More...
|
| |
| void | setHigh (int i, T val) |
| | set the high interval of the box More...
|
| |
| T | getLow (int i) const |
| | get the i-coordinate of the low bound interval of the box More...
|
| |
| T | getHigh (int i) const |
| | get the high interval of the box More...
|
| |
| void | setP1 (const grid_key_dx< dim > &p1) |
| | Set the point P1 of the box. More...
|
| |
| void | setP2 (const grid_key_dx< dim > &p2) |
| | Set the point P2 of the box. More...
|
| |
| void | setP1 (const Point< dim, T > &p1) |
| | Set the point P1 of the box. More...
|
| |
| void | setP2 (const Point< dim, T > &p2) |
| | Set the point P2 of the box. More...
|
| |
| Box< dim, T > & | getBox () |
| | Get the box enclosing this Box. More...
|
| |
| const Box< dim, T > & | getBox () const |
| | Get the box enclosing this Box. More...
|
| |
| type & | getVector () |
| | Get the internal boost::fusion::vector that store the data. More...
|
| |
| grid_key_dx< dim > | getKP1 () const |
| | Get the point p1 as grid_key_dx. More...
|
| |
| grid_key_dx< dim > | getKP2 () const |
| | Get the point p12 as grid_key_dx. More...
|
| |
| Point< dim, T > | getP1 () const |
| | Get the point p1. More...
|
| |
| Point< dim, T > | getP2 () const |
| | Get the point p2. More...
|
| |
| Box< dim, T > & | operator-= (const Point< dim, T > &p) |
| | Translate the box. More...
|
| |
| Box< dim, T > & | operator+= (const Point< dim, T > &p) |
| | Translate the box. More...
|
| |
| void | expand (T(&exp)[dim]) |
| | expand the box by a vector More...
|
| |
| void | enlarge (const Box< dim, T > &gh) |
| | Enlarge the box with ghost margin. More...
|
| |
| template<typename S > |
| void | enlarge_fix_P1 (Box< dim, S > &gh) |
| | Enlarge the box with ghost margin keeping fix the point P1. More...
|
| |
| void | invalidate () |
| | Invalidate the box. More...
|
| |
| void | magnify (T mg) |
| | Magnify the box. More...
|
| |
| void | magnify_fix_P1 (T mg) |
| | Magnify the box by a factor keeping fix the point P1. More...
|
| |
| void | shrinkP2 (T sh) |
| | Shrink moving p2 of sh quantity (on each direction) More...
|
| |
| void | enclose (const Box< dim, T > &en) |
| | Refine the box to enclose the given box and itself. More...
|
| |
| void | contained (const Box< dim, T > &en, const bool reset_p1=true) |
| | Refine the box to be contained in the given box and itself. More...
|
| |
| void | zero () |
| | Set p1 and p2 to 0. More...
|
| |
| bool | isContained (const Box< dim, T > &b) const |
| | Check if the box is contained. More...
|
| |
| bool | isInside (const Point< dim, T > &p) const |
| | Check if the point is inside the box. More...
|
| |
| bool | isInsideNP (const Point< dim, T > &p) const |
| | Check if the point is inside the region excluding the positive part. More...
|
| |
| bool | isInsideNB (const Point< dim, T > &p) const |
| | Check if the point is inside the region excluding the borders. More...
|
| |
| bool | isInside (const T(&p)[dim]) const |
| | Check if the point is inside the region. More...
|
| |
| bool | isValid () const |
| | Check if the Box is a valid box P2 >= P1. More...
|
| |
| bool | isValidN () const |
| | Check if the Box is a valid box P2 > P1. More...
|
| |
| void | floorP1 () |
| | Apply the ceil operation to the point P1. More...
|
| |
| void | floorP2 () |
| | Apply the ceil operation to the point P2. More...
|
| |
| void | ceilP1 () |
| | Apply the ceil operation to the point P1. More...
|
| |
| void | ceilP2 () |
| | Apply the ceil operation to the point P2. More...
|
| |
| void | shrinkP2 (const Point< dim, T > &p) |
| | Shrink the point P2 by one vector. More...
|
| |
| void | swap (Box< dim, T > &b) |
| | exchange the data of two boxes More...
|
| |
| template<typename Mem > |
| bool | isInside (const encapc< 1, Point< dim, T >, Mem > &p) |
| | Check if the point is inside the region. More...
|
| |
| T | getVolume () const |
| | Get the volume of the box. More...
|
| |
| T | getVolumeKey () const |
| | Get the volume spanned by the Box P1 and P2 interpreted as grid key. More...
|
| |
| Point< dim, T > | middle () const |
| | Return the middle point of the box. More...
|
| |
| std::string | toString () const |
| | Produce a string from the object. More...
|
| |
| bool | operator== (const Box< dim, T > &b) const |
| | Compare two boxes. More...
|
| |
| bool | operator!= (const Box< dim, T > &b) const |
| | Compare two boxes. More...
|
| |