LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geoalgo::HalfLine Class Reference

Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (Point_t) and direction (Vector_t)
along which the line extends. It hides the start and direction attributes from users for
protecting the dimensionality. More...

#include "GeoHalfLine.h"

Inheritance diagram for geoalgo::HalfLine:
geoalgo::Cone

Public Member Functions

 HalfLine ()
 Default constructor. More...
 
virtual ~HalfLine ()
 Default destructor. More...
 
 HalfLine (const double x, const double y, const double z, const double dirx, const double diry, const double dirz)
 Alternative ctor (1) More...
 
 HalfLine (const Point_t &start, const Vector_t &dir)
 Altenartive ctor (2) More...
 
const Point_tStart () const
 Start getter. More...
 
const Vector_tDir () const
 Direction getter. More...
 
void Start (const double x, const double y, const double z)
 Start setter. More...
 
void Dir (const double x, const double y, const double z)
 Dir setter. More...
 
void Start (const TVector3 &pt)
 Start setter. More...
 
void Dir (const TVector3 &dir)
 Dir setter. More...
 
template<class T , class U >
 HalfLine (const T &start, const U &dir)
 Alternative ctor using template (3) More...
 
template<class T >
void Start (const T &pos)
 Start setter template. More...
 
template<class T >
void Dir (const T &dir)
 Dir setter template. More...
 

Protected Member Functions

void Normalize ()
 Normalize direction. More...
 

Protected Attributes

Point_t _start
 Beginning of the half line. More...
 
Vector_t _dir
 Direction of the half line from _start. More...
 

Detailed Description

Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (Point_t) and direction (Vector_t)
along which the line extends. It hides the start and direction attributes from users for
protecting the dimensionality.

Definition at line 30 of file GeoHalfLine.h.

Constructor & Destructor Documentation

geoalgo::HalfLine::HalfLine ( )

Default constructor.

Definition at line 5 of file GeoHalfLine.cxx.

References Normalize().

Referenced by ~HalfLine().

5  : _start(3), _dir(3)
6  {
7  Normalize();
8  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
virtual geoalgo::HalfLine::~HalfLine ( )
inlinevirtual

Default destructor.

Definition at line 37 of file GeoHalfLine.h.

References dir, Dir(), HalfLine(), Normalize(), pt, Start(), x, y, and z.

37 {};
geoalgo::HalfLine::HalfLine ( const double  x,
const double  y,
const double  z,
const double  dirx,
const double  diry,
const double  dirz 
)

Alternative ctor (1)

Definition at line 10 of file GeoHalfLine.cxx.

References Normalize().

16  : _start(x, y, z), _dir(dirx, diry, dirz)
17  {
18  Normalize();
19  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
geoalgo::HalfLine::HalfLine ( const Point_t start,
const Vector_t dir 
)

Altenartive ctor (2)

Definition at line 21 of file GeoHalfLine.cxx.

References Normalize().

21  : _start(start), _dir(dir)
22  {
23  if (start.size() != 3 || dir.size() != 3)
24  throw GeoAlgoException("HalfLine ctor accepts only 3D Point!");
25  Normalize();
26  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
TDirectory * dir
Definition: macro.C:5
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
template<class T , class U >
geoalgo::HalfLine::HalfLine ( const T &  start,
const U &  dir 
)
inline

Alternative ctor using template (3)

Definition at line 71 of file GeoHalfLine.h.

71  : HalfLine(Point_t(start), Vector_t(dir))
72  {}
Vector Point_t
Definition: GeoVector.h:204
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:5
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:203

Member Function Documentation

const Vector_t & geoalgo::HalfLine::Dir ( ) const

Direction getter.

Definition at line 33 of file GeoHalfLine.cxx.

References _dir.

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

34  {
35  return _dir;
36  }
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
void geoalgo::HalfLine::Dir ( const double  x,
const double  y,
const double  z 
)

Dir setter.

Definition at line 45 of file GeoHalfLine.cxx.

References _dir, Normalize(), x, y, and z.

46  {
47  _dir[0] = x;
48  _dir[1] = y;
49  _dir[2] = z;
50  Normalize();
51  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
void geoalgo::HalfLine::Dir ( const TVector3 &  dir)

Dir setter.

Definition at line 60 of file GeoHalfLine.cxx.

References _dir, and Normalize().

61  {
62  _dir[0] = dir[0];
63  _dir[1] = dir[1];
64  _dir[2] = dir[2];
65  Normalize();
66  }
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
TDirectory * dir
Definition: macro.C:5
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
template<class T >
void geoalgo::HalfLine::Dir ( const T &  dir)
inline

Dir setter template.

Definition at line 85 of file GeoHalfLine.h.

References Normalize().

86  {
87  _dir = Vector_t(dir);
88  if (_dir.size() != 3)
89  throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
90  Normalize();
91  }
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:68
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:203
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
void geoalgo::HalfLine::Normalize ( )
protected

Normalize direction.

Definition at line 68 of file GeoHalfLine.cxx.

References _dir, and geoalgo::Vector::Length().

Referenced by Dir(), HalfLine(), and ~HalfLine().

69  {
70  auto l = _dir.Length();
71  if (!l) throw GeoAlgoException("<<Normalize>> cannot normalize 0-length direction vector!");
72 
73  // inf check commented out till compatible solution found... --kazu
74  //if(isnan(l))
75  //throw GeoAlgoException("<<Normalize>> cannot normalize inf-length direction vector!");
76  _dir /= l;
77  }
double Length() const
Compute the length of the vector.
Definition: GeoVector.cxx:57
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:62
void geoalgo::HalfLine::Start ( const double  x,
const double  y,
const double  z 
)

Start setter.

Definition at line 38 of file GeoHalfLine.cxx.

References _start, x, y, and z.

39  {
40  _start[0] = x;
41  _start[1] = y;
42  _start[2] = z;
43  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
void geoalgo::HalfLine::Start ( const TVector3 &  pt)

Start setter.

Definition at line 53 of file GeoHalfLine.cxx.

References _start.

54  {
55  _start[0] = pt[0];
56  _start[1] = pt[1];
57  _start[2] = pt[2];
58  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
TMarker * pt
Definition: egs.C:25
template<class T >
void geoalgo::HalfLine::Start ( const T &  pos)
inline

Start setter template.

Definition at line 76 of file GeoHalfLine.h.

77  {
78  _start = Point_t(pos);
79  if (_start.size() != 3)
80  throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
81  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:61
Vector Point_t
Definition: GeoVector.h:204

Member Data Documentation

Vector_t geoalgo::HalfLine::_dir
protected

Direction of the half line from _start.

Definition at line 62 of file GeoHalfLine.h.

Referenced by Dir(), and Normalize().

Point_t geoalgo::HalfLine::_start
protected

Beginning of the half line.

Definition at line 61 of file GeoHalfLine.h.

Referenced by Start().


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