LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GeoLineSegment.cxx
Go to the documentation of this file.
3 
4 namespace geoalgo {
5 
6  LineSegment::LineSegment() : _start(3), _end(3), _dir(3)
7  {
8  DirReset();
9  }
10 
11  LineSegment::LineSegment(const double start_x,
12  const double start_y,
13  const double start_z,
14  const double end_x,
15  const double end_y,
16  const double end_z)
17  : _start(start_x, start_y, start_z), _end(end_x, end_y, end_z), _dir(3)
18  {
19  DirReset();
20  }
21 
23  : _start(start), _end(end), _dir(3)
24  {
25  if (start.size() != 3 || end.size() != 3)
26  throw GeoAlgoException("LineSegment ctor accepts only 3D Point!");
27  DirReset();
28  }
29 
30  const Point_t& LineSegment::Start() const
31  {
32  return _start;
33  }
34 
35  const Point_t& LineSegment::End() const
36  {
37  return _end;
38  }
39 
40  const Vector_t LineSegment::Dir() const
41  {
42  return _dir;
43  }
44 
45  void LineSegment::Start(const double x, const double y, const double z)
46  {
47  _start[0] = x;
48  _start[1] = y;
49  _start[2] = z;
50  DirReset();
51  }
52 
53  void LineSegment::End(const double x, const double y, const double z)
54  {
55  _end[0] = x;
56  _end[1] = y;
57  _end[2] = z;
58  DirReset();
59  }
60 
62  {
63  _dir = _end - _start;
64  }
65 
66 }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Class def header for a class GeoAlgoException.
Double_t z
Definition: plot.C:276
const Vector_t Dir() const
Direction getter.
Vector_t _dir
Direction.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
const Point_t & End() const
End getter.
LineSegment()
Default constructor.
Point_t _end
End position of a line.
const Point_t & Start() const
Start getter.
Point_t _start
Start position of a line.
void DirReset()
Internal function to reset direction.
Class def header for a class LineSegment.