LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GeoAABox.cxx
Go to the documentation of this file.
3 
4 namespace geoalgo {
5 
6  AABox::AABox() : _min(3), _max(3) {}
7 
8  AABox::AABox(const double x_min,
9  const double y_min,
10  const double z_min,
11  const double x_max,
12  const double y_max,
13  const double z_max)
14  : _min(x_min, y_min, z_min), _max(x_max, y_max, z_max)
15  {}
16 
17  AABox::AABox(const Point_t& min, const Vector_t& max) : _min(min), _max(max)
18  {
19  if (min.size() != 3 || max.size() != 3)
20  throw GeoAlgoException("AABox ctor accepts only 3D Point!");
21  }
22 
23  const Point_t& AABox::Min() const
24  {
25  return _min;
26  }
27  const Point_t& AABox::Max() const
28  {
29  return _max;
30  }
31 
32  void AABox::Min(const double x, const double y, const double z)
33  {
34  _min[0] = x;
35  _min[1] = y;
36  _min[2] = z;
37  }
38  void AABox::Max(const double x, const double y, const double z)
39  {
40  _max[0] = x;
41  _max[1] = y;
42  _max[2] = z;
43  }
44 
45  bool AABox::Contain(const Point_t& pt) const
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  }
52 }
Float_t x
Definition: compare.C:6
AABox()
Default constructor.
Definition: GeoAABox.cxx:6
Float_t y
Definition: compare.C:6
Class def header for a class GeoAlgoException.
Double_t z
Definition: plot.C:276
Point_t _max
Maximum point.
Definition: GeoAABox.h:65
Point_t _min
Minimum point.
Definition: GeoAABox.h:64
const Point_t & Min() const
Minimum point getter.
Definition: GeoAABox.cxx:23
Class def header for a class AABox.
double x_min
Definition: berger.C:15
bool Contain(const Point_t &pt) const
Test if a point is contained within the box.
Definition: GeoAABox.cxx:45
TMarker * pt
Definition: egs.C:25
double x_max
Definition: berger.C:16
const Point_t & Max() const
Maximum point getter.
Definition: GeoAABox.cxx:27