Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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.

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

Default destructor.

Definition at line 38 of file GeoHalfLine.h.

38 {};
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.

12  : _start (x, y, z )
13  , _dir (dirx, diry, dirz)
14  {Normalize();}
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:59
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:41
list x
Definition: train.py:276
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:60
geoalgo::HalfLine::HalfLine ( const Point_t start,
const Vector_t dir 
)

Altenartive ctor (2)

Definition at line 16 of file GeoHalfLine.cxx.

17  : _start ( start )
18  , _dir ( dir )
19  {
20  if(start.size()!=3 || dir.size()!=3)
21  throw GeoAlgoException("HalfLine ctor accepts only 3D Point!");
22  Normalize();
23  }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:59
string dir
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:41
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:60
template<class T , class U >
geoalgo::HalfLine::HalfLine ( const T &  start,
const U &  dir 
)
inline

Alternative ctor using template (3)

Definition at line 69 of file GeoHalfLine.h.

70  : HalfLine(Point_t(start), Vector_t(dir))
71  {}
string dir
Vector Point_t
Definition: GeoVector.h:196
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:195

Member Function Documentation

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

Direction getter.

Definition at line 27 of file GeoHalfLine.cxx.

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

Dir setter.

Definition at line 32 of file GeoHalfLine.cxx.

33  { _dir[0] = x; _dir[1] = y; _dir[2] = z; Normalize(); }
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:41
list x
Definition: train.py:276
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:60
void geoalgo::HalfLine::Dir ( const TVector3 &  dir)

Dir setter.

Definition at line 38 of file GeoHalfLine.cxx.

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

Dir setter template.

Definition at line 83 of file GeoHalfLine.h.

84  {
85  _dir = Vector_t(dir);
86  if(_dir.size()!=3) throw GeoAlgoException("<<Start>> Only 3 dimensional start point allowed!");
87  Normalize();
88  }
string dir
void Normalize()
Normalize direction.
Definition: GeoHalfLine.cxx:41
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:195
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:60
void geoalgo::HalfLine::Normalize ( )
protected

Normalize direction.

Definition at line 41 of file GeoHalfLine.cxx.

42  {
43  auto l = _dir.Length();
44  if(!l)
45  throw GeoAlgoException("<<Normalize>> cannot normalize 0-length direction vector!");
46 
47  // inf check commented out till compatible solution found... --kazu
48  //if(isnan(l))
49  //throw GeoAlgoException("<<Normalize>> cannot normalize inf-length direction vector!");
50  _dir /= l;
51  }
static QStrList * l
Definition: config.cpp:1044
double Length() const
Compute the length of the vector.
Definition: GeoVector.cxx:40
Vector_t _dir
Direction of the half line from _start.
Definition: GeoHalfLine.h:60
const Point_t & geoalgo::HalfLine::Start ( ) const

Start getter.

Definition at line 25 of file GeoHalfLine.cxx.

25 { return _start; }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:59
void geoalgo::HalfLine::Start ( const double  x,
const double  y,
const double  z 
)

Start setter.

Definition at line 29 of file GeoHalfLine.cxx.

30  { _start[0] = x; _start[1] = y; _start[2] = z; }
Point_t _start
Beginning of the half line.
Definition: GeoHalfLine.h:59
list x
Definition: train.py:276
void geoalgo::HalfLine::Start ( const TVector3 &  pt)

Start setter.

Definition at line 35 of file GeoHalfLine.cxx.

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

Start setter template.

Definition at line 75 of file GeoHalfLine.h.

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

Member Data Documentation

Vector_t geoalgo::HalfLine::_dir
protected

Direction of the half line from _start.

Definition at line 60 of file GeoHalfLine.h.

Point_t geoalgo::HalfLine::_start
protected

Beginning of the half line.

Definition at line 59 of file GeoHalfLine.h.


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