LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GeoAABox.cxx
Go to the documentation of this file.
1 #ifndef BASICTOOL_GEOAABOX_CXX
2 #define BASICTOOL_GEOAABOX_CXX
3 
4 #include "GeoAABox.h"
5 
6 namespace geoalgo {
7 
9  : _min(3)
10  , _max(3)
11  {}
12 
13  AABox::AABox(const double x_min, const double y_min, const double z_min,
14  const double x_max, const double y_max, const double z_max)
15  : _min ( x_min, y_min, z_min )
16  , _max ( x_max, y_max, z_max )
17  {}
18 
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  }
26 
27  const Point_t& AABox::Min() const { return _min; }
28  const Point_t& AABox::Max() const { return _max; }
29 
30  void AABox::Min(const double x, const double y, const double z)
31  { _min[0] = x; _min[1] = y; _min[2] = z; }
32  void AABox::Max(const double x, const double y, const double z)
33  { _max[0] = x; _max[1] = y; _max[2] = z; }
34 
35  bool AABox::Contain(const Point_t &pt) const {
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  }
41 }
42 #endif
43 
44 
Float_t x
Definition: compare.C:6
AABox()
Default constructor.
Definition: GeoAABox.cxx:8
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Point_t _max
Maximum point.
Definition: GeoAABox.h:63
Point_t _min
Minimum point.
Definition: GeoAABox.h:62
const Point_t & Min() const
Minimum point getter.
Definition: GeoAABox.cxx:27
Class def header for a class AABox.
double x_min
Definition: berger.C:15
Int_t max
Definition: plot.C:27
bool Contain(const Point_t &pt) const
Test if a point is contained within the box.
Definition: GeoAABox.cxx:35
TMarker * pt
Definition: egs.C:25
double x_max
Definition: berger.C:16
Int_t min
Definition: plot.C:26
const Point_t & Max() const
Maximum point getter.
Definition: GeoAABox.cxx:28