LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 26 of file GeoHalfLine.h.

Constructor & Destructor Documentation

geoalgo::HalfLine::HalfLine ( )

Default constructor.

Definition at line 7 of file GeoHalfLine.cxx.

References Normalize().

Referenced by ~HalfLine().

8  : _start(3)
9  , _dir(3)
10  {Normalize();}
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:55
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:43
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56
virtual geoalgo::HalfLine::~HalfLine ( )
inlinevirtual

Default destructor.

Definition at line 34 of file GeoHalfLine.h.

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

34 {};
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 12 of file GeoHalfLine.cxx.

References Normalize().

14  : _start (x, y, z )
15  , _dir (dirx, diry, dirz)
16  {Normalize();}
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:55
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:43
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56
geoalgo::HalfLine::HalfLine ( const Point_t start,
const Vector_t dir 
)

Altenartive ctor (2)

Definition at line 18 of file GeoHalfLine.cxx.

References Normalize().

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

Alternative ctor using template (3)

Definition at line 65 of file GeoHalfLine.h.

66  : HalfLine(Point_t(start), Vector_t(dir))
67  {}
Vector Point_t
Definition: GeoVector.h:200
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:7
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199

Member Function Documentation

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

Direction getter.

Definition at line 29 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().

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

Dir setter.

Definition at line 34 of file GeoHalfLine.cxx.

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

35  { _dir[0] = x; _dir[1] = y; _dir[2] = z; Normalize(); }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:43
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56
void geoalgo::HalfLine::Dir ( const TVector3 &  dir)

Dir setter.

Definition at line 40 of file GeoHalfLine.cxx.

References _dir, and Normalize().

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

Dir setter template.

Definition at line 79 of file GeoHalfLine.h.

References Normalize().

80  {
81  _dir = Vector_t(dir);
82  if(_dir.size()!=3) throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
83  Normalize();
84  }
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:43
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56
void geoalgo::HalfLine::Normalize ( )
protected

Normalize direction.

Definition at line 43 of file GeoHalfLine.cxx.

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

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

44  {
45  auto l = _dir.Length();
46  if(!l)
47  throw GeoAlgoException("<<Normalize>> cannot normalize 0-length direction vector!");
48 
49  // inf check commented out till compatible solution found... --kazu
50  //if(isnan(l))
51  //throw GeoAlgoException("<<Normalize>> cannot normalize inf-length direction vector!");
52  _dir /= l;
53  }
double Length() const
Compute the length of the vector.
Definition: GeoVector.cxx:44
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:56
void geoalgo::HalfLine::Start ( const double  x,
const double  y,
const double  z 
)

Start setter.

Definition at line 31 of file GeoHalfLine.cxx.

References _start, x, y, and z.

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

Start setter.

Definition at line 37 of file GeoHalfLine.cxx.

References _start.

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

Start setter template.

Definition at line 71 of file GeoHalfLine.h.

72  {
73  _start = Point_t(pos);
74  if(_start.size()!=3) throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
75  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:55
Vector Point_t
Definition: GeoVector.h:200

Member Data Documentation

Vector_t geoalgo::HalfLine::_dir
protected

Direction of the half line from _start.

Definition at line 56 of file GeoHalfLine.h.

Referenced by Dir(), and Normalize().

Point_t geoalgo::HalfLine::_start
protected

Beginning of the half line.

Definition at line 55 of file GeoHalfLine.h.

Referenced by Start().


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