LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GeoLine.h
Go to the documentation of this file.
1 
14 #ifndef BASICTOOL_GEOLINE_H
15 #define BASICTOOL_GEOLINE_H
16 
18 
19 namespace geoalgo {
27  class Line {
28 
29  public:
31  Line();
32 
34  virtual ~Line() {}
35 
37  Line(const double x1,
38  const double y1,
39  const double z1,
40  const double x2,
41  const double y2,
42  const double z2);
43 
45  Line(const Point_t& pt1, const Point_t& pt2);
46 
47  //
48  // Getters
49  //
50  const Point_t& Pt1() const;
51  const Point_t& Pt2() const;
52 
53  //
54  // Setters
55  //
56  void Pt1(const double x, const double y, const double z);
57  void Pt2(const double x, const double y, const double z);
58 
59  protected:
61  void check_and_raise(const Point_t& p1, const Point_t& p2) const;
62 
65 
66  public:
67  //
68  // Template
69  //
71  template <class T, class U>
72  Line(const T& pt1, const U& pt2) : Line(Point_t(pt1), Point_t(pt2))
73  {}
74 
76  template <class T>
77  void Pt1(const T& pt1)
78  {
79  _pt1 = Point_t(pt1);
80  check_and_raise(_pt1, _pt2);
81  }
82 
84  template <class T>
85  void Pt2(const T& pt2)
86  {
87  _pt2 = Vector_t(pt2);
88  check_and_raise(_pt1, _pt2);
89  }
90  };
91 
92  typedef Line Line_t;
93 }
94 #endif
95  // end of doxygen group
Float_t x
Definition: compare.C:6
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
const Point_t & Pt2() const
Direction getter.
Definition: GeoLine.cxx:28
virtual ~Line()
Default destructor.
Definition: GeoLine.h:34
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
Float_t y2[n_points_geant4]
Definition: compare.C:26
TText * pt2
Definition: plot.C:64
Class def header for a class Point and Vector.
const Point_t & Pt1() const
Start getter.
Definition: GeoLine.cxx:24
Representation of a 3D infinite line. Defines an infinite 3D line by having 2 points which completely...
Definition: GeoLine.h:27
Vector Point_t
Definition: GeoVector.h:204
void Pt2(const T &pt2)
Pt2 setter template.
Definition: GeoLine.h:85
Line(const T &pt1, const U &pt2)
Alternative ctor using template (3)
Definition: GeoLine.h:72
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:203
TText * pt1
Definition: plot.C:61
Float_t x2[n_points_geant4]
Definition: compare.C:26
Line()
Default constructor.
Definition: GeoLine.cxx:6
Line Line_t
Definition: GeoLine.h:92
void Pt1(const T &pt1)
Pt1 setter template.
Definition: GeoLine.h:77
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:49