LArSoft  v10_04_05
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(double const x_min,
9  double const y_min,
10  double const z_min,
11  double const x_max,
12  double const y_max,
13  double const z_max)
14  : _min(x_min, y_min, z_min), _max(x_max, y_max, z_max)
15  {}
16 
17  AABox::AABox(Point_t const& min, Vector_t const& 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  Point_t const& AABox::Min() const
24  {
25  return _min;
26  }
27  Point_t const& AABox::Max() const
28  {
29  return _max;
30  }
31 
32  void AABox::Min(double const x, double const y, double const z)
33  {
34  _min[0] = x;
35  _min[1] = y;
36  _min[2] = z;
37  }
38  void AABox::Max(double const x, double const y, double const z)
39  {
40  _max[0] = x;
41  _max[1] = y;
42  _max[2] = z;
43  }
44 
45  bool AABox::Contain(Point_t const& 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
Class def header for a class AABox.
double x_min
Definition: berger.C:15
TMarker * pt
Definition: egs.C:25
Point_t const & Max() const
Maximum point getter.
Definition: GeoAABox.cxx:27
bool Contain(Point_t const &pt) const
Test if a point is contained within the box.
Definition: GeoAABox.cxx:45
double x_max
Definition: berger.C:16
Point_t const & Min() const
Minimum point getter.
Definition: GeoAABox.cxx:23