Public Member Functions | Protected Attributes | List of all members
geoalgo::AABox Class Reference

Representation of a 3D rectangular box which sides are aligned w/ coordinate axis. A representation of an Axis-Aligned-Boundary-Box, a simple & popular representation of
3D boundary box for collision detection. The concept was taken from the reference,
Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77):
. More...

#include <GeoAABox.h>

Public Member Functions

 AABox ()
 Default constructor. More...
 
virtual ~AABox ()
 Default destructor. More...
 
 AABox (const double x_min, const double y_min, const double z_min, const double x_max, const double y_max, const double z_max)
 Alternative ctor (0) More...
 
 AABox (const Point_t &min, const Vector_t &max)
 Altenartive ctor (1) More...
 
const Point_tMin () const
 Minimum point getter. More...
 
const Point_tMax () const
 Maximum point getter. More...
 
void Min (const double x, const double y, const double z)
 Minimum point setter. More...
 
void Max (const double x, const double y, const double z)
 Maximum point setter. More...
 
bool Contain (const Point_t &pt) const
 Test if a point is contained within the box. More...
 
template<class T , class U >
 AABox (const T &min, const U &max)
 Alternative ctor using template (3) More...
 

Protected Attributes

Point_t _min
 Minimum point. More...
 
Point_t _max
 Maximum point. More...
 

Detailed Description

Representation of a 3D rectangular box which sides are aligned w/ coordinate axis. A representation of an Axis-Aligned-Boundary-Box, a simple & popular representation of
3D boundary box for collision detection. The concept was taken from the reference,
Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77):
.

Ref: http://realtimecollisiondetection.net

This class uses one of the simplest representation for AABox: "min-max" representation.
Though this method requires storing 6 floating point values, class attributes (i.e.
"min" and "max" points) store intuitive values for most UB analyzers. Also it simplifies
utility function implementations.

Definition at line 34 of file GeoAABox.h.

Constructor & Destructor Documentation

geoalgo::AABox::AABox ( )

Default constructor.

Definition at line 6 of file GeoAABox.cxx.

7  : _min(3)
8  , _max(3)
9  {}
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
virtual geoalgo::AABox::~AABox ( )
inlinevirtual

Default destructor.

Definition at line 42 of file GeoAABox.h.

42 {};
geoalgo::AABox::AABox ( const double  x_min,
const double  y_min,
const double  z_min,
const double  x_max,
const double  y_max,
const double  z_max 
)

Alternative ctor (0)

Definition at line 11 of file GeoAABox.cxx.

13  : _min ( x_min, y_min, z_min )
14  , _max ( x_max, y_max, z_max )
15  {}
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
geoalgo::AABox::AABox ( const Point_t min,
const Vector_t max 
)

Altenartive ctor (1)

Definition at line 17 of file GeoAABox.cxx.

18  : _min ( min )
19  , _max ( max )
20  {
21  if(min.size()!=3 || max.size()!=3)
22  throw GeoAlgoException("AABox ctor accepts only 3D Point!");
23  }
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
template<class T , class U >
geoalgo::AABox::AABox ( const T &  min,
const U &  max 
)
inline

Alternative ctor using template (3)

Definition at line 71 of file GeoAABox.h.

73  {}
AABox()
Default constructor.
Definition: GeoAABox.cxx:6
static int max(int a, int b)
Vector Point_t
Definition: GeoVector.h:196
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55

Member Function Documentation

bool geoalgo::AABox::Contain ( const Point_t pt) const

Test if a point is contained within the box.

Definition at line 33 of file GeoAABox.cxx.

33  {
34  return !( (pt[0] < _min[0] || _max[0] < pt[0]) || // point is outside X boundaries OR
35  (pt[1] < _min[1] || _max[1] < pt[1]) || // point is outside Y boundaries OR
36  (pt[2] < _min[2] || _max[2] < pt[2]) // point is outside Z boundaries
37  );
38  }
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
const Point_t & geoalgo::AABox::Max ( ) const

Maximum point getter.

Definition at line 26 of file GeoAABox.cxx.

26 { return _max; }
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
void geoalgo::AABox::Max ( const double  x,
const double  y,
const double  z 
)

Maximum point setter.

Definition at line 30 of file GeoAABox.cxx.

31  { _max[0] = x; _max[1] = y; _max[2] = z; }
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
list x
Definition: train.py:276
const Point_t & geoalgo::AABox::Min ( ) const

Minimum point getter.

Definition at line 25 of file GeoAABox.cxx.

25 { return _min; }
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
void geoalgo::AABox::Min ( const double  x,
const double  y,
const double  z 
)

Minimum point setter.

Definition at line 28 of file GeoAABox.cxx.

29  { _min[0] = x; _min[1] = y; _min[2] = z; }
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
list x
Definition: train.py:276

Member Data Documentation

Point_t geoalgo::AABox::_max
protected

Maximum point.

Definition at line 63 of file GeoAABox.h.

Point_t geoalgo::AABox::_min
protected

Minimum point.

Definition at line 62 of file GeoAABox.h.


The documentation for this class was generated from the following files: