GeoAABox.h
Go to the documentation of this file.
1 /**
2  * \file GeoAABox.h
3  *
4  * \ingroup GeoAlgo
5  *
6  * \brief Class def header for a class AABox
7  *
8  * @author kazuhiro
9  */
10 
11 /** \addtogroup GeoAlgo
12 
13  @{*/
14 #ifndef BASICTOOL_GEOAABOX_H
15 #define BASICTOOL_GEOAABOX_H
16 
17 #include "larcorealg/GeoAlgo/GeoVector.h" // for Point_t, Vector_t
18 
19 namespace geoalgo {
20  /**
21  \class AABox
22  @brief Representation of a 3D rectangular box which sides are aligned w/ coordinate axis.
23  A representation of an Axis-Aligned-Boundary-Box, a simple & popular representation of \n
24  3D boundary box for collision detection. The concept was taken from the reference, \n
25  Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77): \n
26 
27  Ref: http://realtimecollisiondetection.net
28 
29  This class uses one of the simplest representation for AABox: "min-max" representation. \n
30  Though this method requires storing 6 floating point values, class attributes (i.e. \n
31  "min" and "max" points) store intuitive values for most UB analyzers. Also it simplifies \n
32  utility function implementations.
33  */
34  class AABox {
35 
36  public:
37 
38  /// Default constructor
39  AABox();
40 
41  /// Default destructor
42  virtual ~AABox(){};
43 
44  /// Alternative ctor (0)
45  AABox(const double x_min, const double y_min, const double z_min,
46  const double x_max, const double y_max, const double z_max);
47 
48  /// Altenartive ctor (1)
49  AABox(const Point_t& min, const Vector_t& max);
50 
51  //
52  // Attribute accessor
53  //
54  const Point_t& Min() const; ///< Minimum point getter
55  const Point_t& Max() const; ///< Maximum point getter
56  void Min(const double x, const double y, const double z); ///< Minimum point setter
57  void Max(const double x, const double y, const double z); ///< Maximum point setter
58  bool Contain(const Point_t &pt) const; ///< Test if a point is contained within the box
59 
60  protected:
61 
62  Point_t _min; ///< Minimum point
63  Point_t _max; ///< Maximum point
64 
65  public:
66 
67  //
68  // Template
69  //
70  /// Alternative ctor using template (3)
71  template <class T, class U> AABox(const T& min, const U& max)
72  : AABox(Point_t(min), Point_t(max))
73  {}
74 
75  };
76 
77  typedef AABox AABox_t;
78 }
79 #endif
80 /** @} */ // end of doxygen group
AABox()
Default constructor.
Definition: GeoAABox.cxx:6
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): .
Definition: GeoAABox.h:34
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:25
AABox(const T &min, const U &max)
Alternative ctor using template (3)
Definition: GeoAABox.h:71
bool Contain(const Point_t &pt) const
Test if a point is contained within the box.
Definition: GeoAABox.cxx:33
Class def header for a class Point and Vector.
static int max(int a, int b)
virtual ~AABox()
Default destructor.
Definition: GeoAABox.h:42
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
AABox AABox_t
Definition: GeoAABox.h:77
const Point_t & Max() const
Maximum point getter.
Definition: GeoAABox.cxx:26
list x
Definition: train.py:276