LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GeoLine.h
Go to the documentation of this file.
1 
14 #ifndef BASICTOOL_GEOLINE_H
15 #define BASICTOOL_GEOLINE_H
16 
17 #include "GeoHalfLine.h"
18 
19 namespace geoalgo {
27  class Line {
28 
29  public:
30 
32  Line();
33 
35  virtual ~Line(){}
36 
38  Line(const double x1, const double y1, const double z1,
39  const double x2, const double y2, const double z2);
40 
42  Line(const Point_t& pt1, const Point_t& pt2);
43 
44  //
45  // Getters
46  //
47  const Point_t& Pt1() const;
48  const Point_t& Pt2() const;
49 
50  //
51  // Setters
52  //
53  void Pt1(const double x, const double y, const double z);
54  void Pt2(const double x, const double y, const double z);
55 
56  protected:
57 
59  void check_and_raise(const Point_t& p1, const Point_t& p2) const;
60 
63 
64  public:
65  //
66  // Template
67  //
69  template <class T, class U> Line(const T& pt1, const U& pt2)
70  : Line(Point_t(pt1), Point_t(pt2))
71  {}
72 
74  template<class T>
75  void Pt1(const T& pt1)
76  {
77  _pt1 = Point_t(pt1);
78  check_and_raise(_pt1,_pt2);
79  }
80 
82  template<class T>
83  void Pt2(const T& pt2)
84  {
85  _pt2 = Vector_t(pt2);
86  check_and_raise(_pt1,_pt2);
87  }
88  };
89 
90 
91  typedef Line Line_t;
92 }
93 #endif
94  // end of doxygen group
95 
Float_t x
Definition: compare.C:6
Float_t y1[n_points_granero]
Definition: compare.C:5
Class def header for a class HalfLine.
Float_t x1[n_points_granero]
Definition: compare.C:5
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
const Point_t & Pt2() const
Direction getter.
Definition: GeoLine.cxx:25
virtual ~Line()
Default destructor.
Definition: GeoLine.h:35
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:61
Float_t y2[n_points_geant4]
Definition: compare.C:26
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:200
void Pt2(const T &pt2)
Pt2 setter template.
Definition: GeoLine.h:83
Line(const T &pt1, const U &pt2)
Alternative ctor using template (3)
Definition: GeoLine.h:69
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:62
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199
Float_t x2[n_points_geant4]
Definition: compare.C:26
Line()
Default constructor.
Definition: GeoLine.cxx:8
Line Line_t
Definition: GeoLine.h:91
void Pt1(const T &pt1)
Pt1 setter template.
Definition: GeoLine.h:75
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:43