Flow123d  JS_before_hm-2279-gb109077a9
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
BoundingBox Class Reference

Bounding box in 3d ambient space. More...

#include <bounding_box.hh>

Collaboration diagram for BoundingBox:
Collaboration graph
[legend]

Public Types

typedef Space< dimension >::Point Point
 Currently we assume. More...
 

Public Member Functions

 TYPEDEF_ERR_INFO (EI_split_point, double)
 
 TYPEDEF_ERR_INFO (EI_interval_left, double)
 
 TYPEDEF_ERR_INFO (EI_interval_right, double)
 
 DECLARE_EXCEPTION (ExcSplitting,<< "Split point "<< EI_split_point::val<< "out of bounds: <"<< EI_interval_left::val<< ", "<< EI_interval_right::val<< ">\n")
 
 BoundingBox ()
 
 BoundingBox (const Point &min)
 
 BoundingBox (const Point &min, const Point &max)
 
 BoundingBox (const vector< Point > &points)
 
void set_max (unsigned int axis, double max)
 
void set_min (unsigned int axis, double min)
 
const Pointmin () const
 
const Pointmax () const
 
double min (unsigned int axis) const
 
double max (unsigned int axis) const
 
double size (unsigned int axis) const
 
Point center () const
 
double projection_center (unsigned int axis) const
 
bool contains_point (const Point &point) const
 
bool intersect (const BoundingBox &b2) const
 
bool projection_lt (unsigned int axis, double value) const
 
bool projection_gt (unsigned int axis, double value) const
 
void split (unsigned int axis, double splitting_point, BoundingBox &left, BoundingBox &right) const
 
void expand (const Point &point)
 
void expand (const BoundingBox &box)
 
unsigned char longest_axis () const
 
Point project_point (const Point &point) const
 
double longest_size () const
 

Static Public Attributes

static const unsigned int dimension = 3
 Currently we set dimension to 3. More...
 
static const double epsilon = 64*numeric_limits<double>::epsilon()
 stabilization parameter More...
 

Private Attributes

Point min_vertex_
 minimal coordinates of bounding box More...
 
Point max_vertex_
 maximal coordinates of bounding box More...
 

Detailed Description

Bounding box in 3d ambient space.

Primary intention is usage in BIHTree and various speedups of non-compatible intersections.

Copy constructor and assignment are default provided by compiler. These can be used to set bounds latter on without particular method to this end:

BoundingBox box; // non-initialized box
box=BoundingBox( arma::vec3("0 1 2"), arma::vec3("4 5 6") );

Don;t worry about performance, all is inlined.

Definition at line 54 of file bounding_box.hh.

Member Typedef Documentation

◆ Point

Currently we assume.

Definition at line 68 of file bounding_box.hh.

Constructor & Destructor Documentation

◆ BoundingBox() [1/4]

BoundingBox::BoundingBox ( )
inline

Default constructor. No initialization of vertices. Be very careful using this. One necessary usage is vector of BoundigBox.

Definition at line 76 of file bounding_box.hh.

◆ BoundingBox() [2/4]

BoundingBox::BoundingBox ( const Point min)
inline

Constructor for point box.

Definition at line 86 of file bounding_box.hh.

◆ BoundingBox() [3/4]

BoundingBox::BoundingBox ( const Point min,
const Point max 
)
inline

Constructor.

From given minimal and maximal vertex.

Definition at line 95 of file bounding_box.hh.

◆ BoundingBox() [4/4]

BoundingBox::BoundingBox ( const vector< Point > &  points)

Constructor.

Make bounding box for set of points.

Definition at line 25 of file bounding_box.cc.

Member Function Documentation

◆ center()

Point BoundingBox::center ( ) const
inline

Return center of the bounding box.

Definition at line 166 of file bounding_box.hh.

◆ contains_point()

bool BoundingBox::contains_point ( const Point point) const
inline

Returns true is the box element contains point

Parameters
pointTesting point
Returns
True if box element contains point

Definition at line 185 of file bounding_box.hh.

◆ DECLARE_EXCEPTION()

BoundingBox::DECLARE_EXCEPTION ( ExcSplitting  )

◆ expand() [1/2]

void BoundingBox::expand ( const BoundingBox box)
inline

Expand bounding box to contain also given box.

Definition at line 264 of file bounding_box.hh.

◆ expand() [2/2]

void BoundingBox::expand ( const Point point)
inline

Expand bounding box to contain also given point.

Definition at line 253 of file bounding_box.hh.

Here is the caller graph for this function:

◆ intersect()

bool BoundingBox::intersect ( const BoundingBox b2) const
inline

Returns true if two bounding boxes have intersection.

This serves as an estimate of intersection of elements. To make it safe (do not exclude possible intersection) for 1d and 2d elements aligned with axes, we use some tolerance. Since this tolerance is fixed, there could be problem with highly refined meshes (get false positive result).

Definition at line 203 of file bounding_box.hh.

Here is the caller graph for this function:

◆ longest_axis()

unsigned char BoundingBox::longest_axis ( ) const
inline

Return index of the axis in which the box has longest projection.

Definition at line 275 of file bounding_box.hh.

Here is the caller graph for this function:

◆ longest_size()

double BoundingBox::longest_size ( ) const
inline

Return size of the axis in which the box has longest projection.

Definition at line 301 of file bounding_box.hh.

Here is the caller graph for this function:

◆ max() [1/2]

const Point& BoundingBox::max ( ) const
inline

Return maximal vertex of the bounding box.

Definition at line 136 of file bounding_box.hh.

Here is the caller graph for this function:

◆ max() [2/2]

double BoundingBox::max ( unsigned int  axis) const
inline

Return maximal value on given axis.

Definition at line 150 of file bounding_box.hh.

◆ min() [1/2]

const Point& BoundingBox::min ( ) const
inline

Return minimal vertex of the bounding box.

Definition at line 129 of file bounding_box.hh.

Here is the caller graph for this function:

◆ min() [2/2]

double BoundingBox::min ( unsigned int  axis) const
inline

Return minimal value on given axis.

Definition at line 143 of file bounding_box.hh.

◆ project_point()

Point BoundingBox::project_point ( const Point point) const
inline

Project point to bounding box.

If point is in bounding box, returns its.

Definition at line 287 of file bounding_box.hh.

Here is the caller graph for this function:

◆ projection_center()

double BoundingBox::projection_center ( unsigned int  axis) const
inline

Return center of projection of the bounding box to given axis. Axis coding is: 0 - axis x, 1 - axis y, 2 - axis z.

Definition at line 174 of file bounding_box.hh.

◆ projection_gt()

bool BoundingBox::projection_gt ( unsigned int  axis,
double  value 
) const
inline

Returns true if projection of the box to axis is an interval greater then (with tolerance) to given value.

Definition at line 225 of file bounding_box.hh.

Here is the caller graph for this function:

◆ projection_lt()

bool BoundingBox::projection_lt ( unsigned int  axis,
double  value 
) const
inline

Returns true if projection of the box to axis is an interval less then (with tolerance) to given value.

Definition at line 216 of file bounding_box.hh.

Here is the caller graph for this function:

◆ set_max()

void BoundingBox::set_max ( unsigned int  axis,
double  max 
)
inline

Set maximum in given axis.

Definition at line 111 of file bounding_box.hh.

Here is the caller graph for this function:

◆ set_min()

void BoundingBox::set_min ( unsigned int  axis,
double  min 
)
inline

Set minimum on given axis.

Definition at line 120 of file bounding_box.hh.

Here is the caller graph for this function:

◆ size()

double BoundingBox::size ( unsigned int  axis) const
inline

Return size of the box in given axis.

Definition at line 158 of file bounding_box.hh.

◆ split()

void BoundingBox::split ( unsigned int  axis,
double  splitting_point,
BoundingBox left,
BoundingBox right 
) const
inline

Split box into two boxes along axis by the plane going through splitting_point on the axis.

Definition at line 234 of file bounding_box.hh.

◆ TYPEDEF_ERR_INFO() [1/3]

BoundingBox::TYPEDEF_ERR_INFO ( EI_interval_left  ,
double   
)

◆ TYPEDEF_ERR_INFO() [2/3]

BoundingBox::TYPEDEF_ERR_INFO ( EI_interval_right  ,
double   
)

◆ TYPEDEF_ERR_INFO() [3/3]

BoundingBox::TYPEDEF_ERR_INFO ( EI_split_point  ,
double   
)

Member Data Documentation

◆ dimension

const unsigned int BoundingBox::dimension = 3
static

Currently we set dimension to 3.

Definition at line 64 of file bounding_box.hh.

◆ epsilon

const double BoundingBox::epsilon = 64*numeric_limits<double>::epsilon()
static

stabilization parameter

Definition at line 66 of file bounding_box.hh.

◆ max_vertex_

Point BoundingBox::max_vertex_
private

maximal coordinates of bounding box

Definition at line 310 of file bounding_box.hh.

◆ min_vertex_

Point BoundingBox::min_vertex_
private

minimal coordinates of bounding box

Definition at line 308 of file bounding_box.hh.


The documentation for this class was generated from the following files:
arma::vec3
Definition: doxy_dummy_defs.hh:17
BoundingBox
Bounding box in 3d ambient space.
Definition: bounding_box.hh:54
BoundingBox::BoundingBox
BoundingBox()
Definition: bounding_box.hh:76