All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
larcorealg/larcorealg/GeoAlgo/GeoLine.h
Go to the documentation of this file.
1 /**
2  * \file GeoLine.h
3  *
4  * \ingroup GeoAlgo
5  *
6  * \brief Class def header for a class Line
7  *
8  * @author David Caratelli
9  */
10 
11 /** \addtogroup GeoAlgo
12 
13  @{*/
14 #ifndef BASICTOOL_GEOLINE_H
15 #define BASICTOOL_GEOLINE_H
16 
18 
19 namespace geoalgo {
20  /**
21  \class Line
22  @brief Representation of a 3D infinite line.
23  Defines an infinite 3D line by having 2 points which completely determine the line
24  along which the line extends. It hides the point attributes from users for \n
25  protecting the dimensionality.
26  */
27  class Line {
28 
29  public:
30 
31  /// Default constructor
32  Line();
33 
34  /// Default destructor
35  virtual ~Line(){}
36 
37  /// Alternative ctor (1)
38  Line(const double x1, const double y1, const double z1,
39  const double x2, const double y2, const double z2);
40 
41  /// Altenartive ctor (2)
42  Line(const Point_t& pt1, const Point_t& pt2);
43 
44  //
45  // Getters
46  //
47  const Point_t& Pt1() const; ///< Start getter
48  const Point_t& Pt2() const; ///< Direction getter
49 
50  //
51  // Setters
52  //
53  void Pt1(const double x, const double y, const double z); ///< Pt1 setter
54  void Pt2(const double x, const double y, const double z); ///< Pt2 setter
55 
56  protected:
57 
58  /// Compatibility check
59  void check_and_raise(const Point_t& p1, const Point_t& p2) const;
60 
61  Point_t _pt1; ///< First point denoting infinite line
62  Vector_t _pt2; ///< Second point denoting infinite line
63 
64  public:
65  //
66  // Template
67  //
68  /// Alternative ctor using template (3)
69  template <class T, class U> Line(const T& pt1, const U& pt2)
70  : Line(Point_t(pt1), Point_t(pt2))
71  {}
72 
73  /// Pt1 setter template
74  template<class T>
75  void Pt1(const T& pt1)
76  {
77  _pt1 = Point_t(pt1);
79  }
80 
81  /// Pt2 setter template
82  template<class T>
83  void Pt2(const T& pt2)
84  {
85  _pt2 = Vector_t(pt2);
87  }
88  };
89 
90 
91  typedef Line Line_t;
92 }
93 #endif
94 /** @} */ // end of doxygen group
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
const Point_t & Pt2() const
Direction getter.
virtual ~Line()
Default destructor.
Point_t _pt1
First point denoting infinite line.
process_name opflash particleana ie ie y
const Point_t & Pt1() const
Start getter.
Representation of a 3D infinite line. Defines an infinite 3D line by having 2 points which completely...
void Pt2(const T &pt2)
Pt2 setter template.
Line(const T &pt1, const U &pt2)
Alternative ctor using template (3)
Vector_t _pt2
Second point denoting infinite line.
Vector Vector_t
Point has same feature as Vector.
void Pt1(const T &pt1)
Pt1 setter template.
physics associatedGroupsWithLeft p1
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.