LArSoft  v10_04_05
Liquid Argon Software toolkit - https://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 (double const x_min, double const y_min, double const z_min, double const x_max, double const y_max, double const z_max)
 Alternative ctor (0) More...
 
 AABox (Point_t const &min, Vector_t const &max)
 Altenartive ctor (1) More...
 
Point_t const & Min () const
 Minimum point getter. More...
 
Point_t const & Max () const
 Maximum point getter. More...
 
void Min (double const x, double const y, double const z)
 Minimum point setter. More...
 
void Max (double const x, double const y, double const z)
 Maximum point setter. More...
 
bool Contain (Point_t const &pt) const
 Test if a point is contained within the box. More...
 
template<class T , class U >
 AABox (T const &min, U const &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.

Referenced by ~AABox().

6 : _min(3), _max(3) {}
Point_t _max
Maximum point.
Definition: GeoAABox.h:65
Point_t _min
Minimum point.
Definition: GeoAABox.h:64
virtual geoalgo::AABox::~AABox ( )
inlinevirtual

Default destructor.

Definition at line 41 of file GeoAABox.h.

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

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

Alternative ctor (0)

Definition at line 8 of file GeoAABox.cxx.

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

Altenartive ctor (1)

Definition at line 17 of file GeoAABox.cxx.

17  : _min(min), _max(max)
18  {
19  if (min.size() != 3 || max.size() != 3)
20  throw GeoAlgoException("AABox ctor accepts only 3D Point!");
21  }
Point_t _max
Maximum point.
Definition: GeoAABox.h:65
Point_t _min
Minimum point.
Definition: GeoAABox.h:64
template<class T , class U >
geoalgo::AABox::AABox ( T const &  min,
U const &  max 
)
inline

Alternative ctor using template (3)

Definition at line 73 of file GeoAABox.h.

73  : AABox(Point_t(min), Point_t(max))
74  {}
AABox()
Default constructor.
Definition: GeoAABox.cxx:6
Vector Point_t
Definition: GeoVector.h:204

Member Function Documentation

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

Test if a point is contained within the box.

Definition at line 45 of file GeoAABox.cxx.

References _max, and _min.

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

46  {
47  return !((pt[0] < _min[0] || _max[0] < pt[0]) || // point is outside X boundaries OR
48  (pt[1] < _min[1] || _max[1] < pt[1]) || // point is outside Y boundaries OR
49  (pt[2] < _min[2] || _max[2] < pt[2]) // point is outside Z boundaries
50  );
51  }
Point_t _max
Maximum point.
Definition: GeoAABox.h:65
Point_t _min
Minimum point.
Definition: GeoAABox.h:64
TMarker * pt
Definition: egs.C:25
Point_t const & geoalgo::AABox::Max ( ) const

Maximum point getter.

Definition at line 27 of file GeoAABox.cxx.

References _max.

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

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

Maximum point setter.

Definition at line 38 of file GeoAABox.cxx.

References _max, x, y, and z.

39  {
40  _max[0] = x;
41  _max[1] = y;
42  _max[2] = z;
43  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _max
Maximum point.
Definition: GeoAABox.h:65
Point_t const & geoalgo::AABox::Min ( ) const

Minimum point getter.

Definition at line 23 of file GeoAABox.cxx.

References _min.

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

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

Minimum point setter.

Definition at line 32 of file GeoAABox.cxx.

References _min, x, y, and z.

33  {
34  _min[0] = x;
35  _min[1] = y;
36  _min[2] = z;
37  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _min
Minimum point.
Definition: GeoAABox.h:64

Member Data Documentation

Point_t geoalgo::AABox::_max
protected

Maximum point.

Definition at line 65 of file GeoAABox.h.

Referenced by Contain(), and Max().

Point_t geoalgo::AABox::_min
protected

Minimum point.

Definition at line 64 of file GeoAABox.h.

Referenced by Contain(), and Min().


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