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