LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 8 of file GeoAABox.cxx.

Referenced by ~AABox().

9  : _min(3)
10  , _max(3)
11  {}
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.

References AABox(), Contain(), max, Max(), min, Min(), pt, x, x_max, x_min, y, and z.

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 13 of file GeoAABox.cxx.

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

Altenartive ctor (1)

Definition at line 19 of file GeoAABox.cxx.

20  : _min ( min )
21  , _max ( max )
22  {
23  if(min.size()!=3 || max.size()!=3)
24  throw GeoAlgoException("AABox ctor accepts only 3D Point!");
25  }
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
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:8
Int_t max
Definition: plot.C:27
Vector Point_t
Definition: GeoVector.h:200
Int_t min
Definition: plot.C:26

Member Function Documentation

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

Test if a point is contained within the box.

Definition at line 35 of file GeoAABox.cxx.

References _max, and _min.

Referenced by geoalgo::GeoAlgo::_SqDist_(), geoalgo::GeoAlgo::BoxOverlap(), and ~AABox().

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

Maximum point getter.

Definition at line 28 of file GeoAABox.cxx.

References _max.

Referenced by geoalgo::GeoAlgo::_ClosestPt_(), geoalgo::GeoAlgo::_SqDist_(), geoalgo::GeoObjCollection::Add(), geoalgo::GeoAlgo::Intersection(), and ~AABox().

28 { 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 32 of file GeoAABox.cxx.

References _max, x, y, and z.

33  { _max[0] = x; _max[1] = y; _max[2] = z; }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
const Point_t & geoalgo::AABox::Min ( ) const
void geoalgo::AABox::Min ( const double  x,
const double  y,
const double  z 
)

Minimum point setter.

Definition at line 30 of file GeoAABox.cxx.

References _min, x, y, and z.

31  { _min[0] = x; _min[1] = y; _min[2] = z; }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Point_t _min
Minimum point.
Definition: GeoAABox.h:62

Member Data Documentation

Point_t geoalgo::AABox::_max
protected

Maximum point.

Definition at line 63 of file GeoAABox.h.

Referenced by Contain(), and Max().

Point_t geoalgo::AABox::_min
protected

Minimum point.

Definition at line 62 of file GeoAABox.h.

Referenced by Contain(), and Min().


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