LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GeoLine.cxx
Go to the documentation of this file.
1 #ifndef BASICTOOL_GEOLINE_CXX
2 #define BASICTOOL_GEOLINE_CXX
3 
4 #include "GeoLine.h"
5 
6 namespace geoalgo {
7 
9  : _pt1(3)
10  , _pt2(3)
11  {}
12 
13  Line::Line(const double x1, const double y1, const double z1,
14  const double x2, const double y2, const double z2)
15  : _pt1 (x1, y1, z1)
16  , _pt2 (x2, y2, z2)
18 
19  Line::Line(const Point_t& pt1, const Point_t& pt2)
20  : _pt1 ( pt1 )
21  , _pt2 ( pt2 )
22  { check_and_raise(pt1,pt2); }
23 
24  const Point_t& Line::Pt1() const { return _pt1; }
25  const Point_t& Line::Pt2() const { return _pt2; }
26 
27  void Line::Pt1(const double x, const double y, const double z)
28  {
29  _pt1[0] = x;
30  _pt1[1] = y;
31  _pt1[2] = z;
33  }
34 
35  void Line::Pt2(const double x, const double y, const double z)
36  {
37  _pt2[0] = x;
38  _pt2[1] = y;
39  _pt2[2] = z;
41  }
42 
43  void Line::check_and_raise(const Point_t& p1, const Point_t& p2) const
44  {
45  if(p1.size()!=3) throw GeoAlgoException("<<check_and_raise>> Pt1 is not 3 dimensional point!");
46  if(p2.size()!=3) throw GeoAlgoException("<<check_and_raise>> Pt2 is not 3 dimensional point!");
47  if(p1 == p2) throw GeoAlgoException("<<check_and_raise>> Two identical points not allowed for Line ctor!");
48  }
49 
50 }
51 #endif
52  // end of doxygen group
53 
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:279
Class def header for a class Line.
const Point_t & Pt2() const
Direction getter.
Definition: GeoLine.cxx:25
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
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:62
Float_t x2[n_points_geant4]
Definition: compare.C:26
Line()
Default constructor.
Definition: GeoLine.cxx:8
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:43