LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geoalgo::LineSegment Class Reference

Representation of a simple 3D line segment Defines a finite 3D straight line by having the start and end position (Point_t).
. More...

#include "GeoLineSegment.h"

Public Member Functions

 LineSegment ()
 Default constructor. More...
 
virtual ~LineSegment ()
 Default destructor. More...
 
 LineSegment (double const start_x, double const start_y, double const start_z, double const end_x, double const end_y, double const end_z)
 Alternative ctor (1) More...
 
 LineSegment (Point_t const &start, Point_t const &end)
 Altenartive ctor (2) More...
 
Point_t const & Start () const
 Start getter. More...
 
Point_t const & End () const
 End getter. More...
 
Vector_t const Dir () const
 Direction getter. More...
 
void Start (double const x, double const y, double const z)
 Start setter. More...
 
void End (double const x, double const y, double const z)
 End setter. More...
 
template<class T , class U >
 LineSegment (T const &start, U const &end)
 Alternative ctor using template (3) More...
 

Protected Member Functions

void DirReset ()
 Internal function to reset direction. More...
 

Protected Attributes

Point_t _start
 Start position of a line. More...
 
Point_t _end
 End position of a line. More...
 
Vector_t _dir
 Direction. More...
 

Detailed Description

Representation of a simple 3D line segment Defines a finite 3D straight line by having the start and end position (Point_t).
.

Definition at line 25 of file GeoLineSegment.h.

Constructor & Destructor Documentation

geoalgo::LineSegment::LineSegment ( )

Default constructor.

Definition at line 6 of file GeoLineSegment.cxx.

References DirReset().

Referenced by ~LineSegment().

6  : _start(3), _end(3), _dir(3)
7  {
8  DirReset();
9  }
Vector_t _dir
Direction.
Point_t _end
End position of a line.
Point_t _start
Start position of a line.
void DirReset()
Internal function to reset direction.
virtual geoalgo::LineSegment::~LineSegment ( )
inlinevirtual

Default destructor.

Definition at line 32 of file GeoLineSegment.h.

References Dir(), DirReset(), End(), util::end(), LineSegment(), Start(), x, y, and z.

32 {}
geoalgo::LineSegment::LineSegment ( double const  start_x,
double const  start_y,
double const  start_z,
double const  end_x,
double const  end_y,
double const  end_z 
)

Alternative ctor (1)

Definition at line 11 of file GeoLineSegment.cxx.

References DirReset().

17  : _start(start_x, start_y, start_z), _end(end_x, end_y, end_z), _dir(3)
18  {
19  DirReset();
20  }
Vector_t _dir
Direction.
Point_t _end
End position of a line.
Point_t _start
Start position of a line.
void DirReset()
Internal function to reset direction.
geoalgo::LineSegment::LineSegment ( Point_t const &  start,
Point_t const &  end 
)

Altenartive ctor (2)

Definition at line 22 of file GeoLineSegment.cxx.

References DirReset().

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  }
Vector_t _dir
Direction.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Point_t _end
End position of a line.
Point_t _start
Start position of a line.
void DirReset()
Internal function to reset direction.
template<class T , class U >
geoalgo::LineSegment::LineSegment ( T const &  start,
U const &  end 
)
inline

Alternative ctor using template (3)

Definition at line 70 of file GeoLineSegment.h.

70  : LineSegment(Point_t(start), Point_t(end))
71  {}
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
LineSegment()
Default constructor.
Vector Point_t
Definition: GeoVector.h:204

Member Function Documentation

Vector_t const geoalgo::LineSegment::Dir ( ) const

Direction getter.

Definition at line 40 of file GeoLineSegment.cxx.

References _dir.

Referenced by geoalgo::GeoAlgo::_ClosestPt_(), geoalgo::GeoAlgo::_commonOrigin_(), and ~LineSegment().

41  {
42  return _dir;
43  }
Vector_t _dir
Direction.
void geoalgo::LineSegment::DirReset ( )
protected

Internal function to reset direction.

Definition at line 61 of file GeoLineSegment.cxx.

References _dir, _end, and _start.

Referenced by End(), LineSegment(), Start(), and ~LineSegment().

62  {
63  _dir = _end - _start;
64  }
Vector_t _dir
Direction.
Point_t _end
End position of a line.
Point_t _start
Start position of a line.
Point_t const & geoalgo::LineSegment::End ( ) const

End getter.

Definition at line 35 of file GeoLineSegment.cxx.

References _end.

Referenced by geoalgo::GeoAlgo::_ClosestPt_(), geoalgo::GeoAlgo::_SqDist_(), geoalgo::GeoObjCollection::Add(), geoalgo::GeoAlgo::Intersection(), and ~LineSegment().

36  {
37  return _end;
38  }
Point_t _end
End position of a line.
void geoalgo::LineSegment::End ( double const  x,
double const  y,
double const  z 
)

End setter.

Definition at line 53 of file GeoLineSegment.cxx.

References _end, DirReset(), x, y, and z.

54  {
55  _end[0] = x;
56  _end[1] = y;
57  _end[2] = z;
58  DirReset();
59  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _end
End position of a line.
void DirReset()
Internal function to reset direction.
Point_t const & geoalgo::LineSegment::Start ( ) const
void geoalgo::LineSegment::Start ( double const  x,
double const  y,
double const  z 
)

Start setter.

Definition at line 45 of file GeoLineSegment.cxx.

References _start, DirReset(), x, y, and z.

46  {
47  _start[0] = x;
48  _start[1] = y;
49  _start[2] = z;
50  DirReset();
51  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _start
Start position of a line.
void DirReset()
Internal function to reset direction.

Member Data Documentation

Vector_t geoalgo::LineSegment::_dir
protected

Direction.

Definition at line 62 of file GeoLineSegment.h.

Referenced by Dir(), and DirReset().

Point_t geoalgo::LineSegment::_end
protected

End position of a line.

Definition at line 61 of file GeoLineSegment.h.

Referenced by DirReset(), and End().

Point_t geoalgo::LineSegment::_start
protected

Start position of a line.

Definition at line 60 of file GeoLineSegment.h.

Referenced by DirReset(), and Start().


The documentation for this class was generated from the following files: