LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GeoHalfLine.h
Go to the documentation of this file.
1 
14 #ifndef BASICTOOL_GEOHALFLINE_H
15 #define BASICTOOL_GEOHALFLINE_H
16 
17 #include "GeoVector.h"
18 namespace geoalgo {
26  class HalfLine {
27 
28  public:
29 
31  HalfLine();
32 
34  virtual ~HalfLine(){};
35 
37  HalfLine(const double x, const double y, const double z,
38  const double dirx, const double diry, const double dirz);
39 
41  HalfLine(const Point_t& start, const Vector_t& dir);
42 
43  const Point_t& Start () const;
44  const Vector_t& Dir () const;
45 
46  void Start(const double x, const double y, const double z);
47  void Dir (const double x, const double y, const double z);
48 
49  void Start(const TVector3& pt );
50  void Dir (const TVector3& dir);
51 
52  protected:
53 
54  void Normalize();
57 
58  public:
59 
60  //
61  // Template
62  //
63 
65  template <class T, class U> HalfLine(const T& start, const U& dir)
66  : HalfLine(Point_t(start), Vector_t(dir))
67  {}
68 
70  template<class T>
71  void Start(const T& pos)
72  {
73  _start = Point_t(pos);
74  if(_start.size()!=3) throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
75  }
76 
78  template<class T>
79  void Dir(const T& dir)
80  {
81  _dir = Vector_t(dir);
82  if(_dir.size()!=3) throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
83  Normalize();
84  }
85 
86  };
87 
89 }
90 #endif
91  // end of doxygen group
92 
Float_t x
Definition: compare.C:6
const Point_t & Start() const
Start getter.
Definition: GeoHalfLine.cxx:27
void Start(const T &pos)
Start setter template.
Definition: GeoHalfLine.h:71
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:55
HalfLine(const T &start, const U &dir)
Alternative ctor using template (3)
Definition: GeoHalfLine.h:65
virtual ~HalfLine()
Default destructor.
Definition: GeoHalfLine.h:34
Class def header for a class Point and Vector.
void Dir(const T &dir)
Dir setter template.
Definition: GeoHalfLine.h:79
TMarker * pt
Definition: egs.C:25
const Vector_t & Dir() const
Direction getter.
Definition: GeoHalfLine.cxx:29
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:43
Vector Point_t
Definition: GeoVector.h:200
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:7
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...
Definition: GeoHalfLine.h:26
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56