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

Representation of a 3D semi-infinite line. Defines a 3D cone with the following properties:
Start point (or vertex), Direction, Length (or Length), Radius, opening angle
When 2 of Length, Radius, opening angle are defined the third is automatically set. More...

#include "GeoCone.h"

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

Public Member Functions

 Cone ()
 Default constructor. More...
 
virtual ~Cone ()
 Default destructor. More...
 
 Cone (double const x, double const y, double const z, double const dirx, double const diry, double const dirz, double const length, double const radius)
 Alternative ctor (1) More...
 
 Cone (Point_t const &start, Vector_t const &dir, double const length, double const radius)
 Alternative ctor (2) More...
 
double Length () const
 Length getter. More...
 
double Radius () const
 Length getter. More...
 
double Angle () const
 Angle getter. More...
 
void Length (double const l)
 Length setter. More...
 
void Radius (double const r)
 Radius setter. More...
 
template<class T , class U >
 Cone (T const &start, U const &dir)
 Alternative ctor using template (3) More...
 
Point_t const & Start () const
 Start getter. More...
 
void Start (double const x, double const y, double const z)
 Start setter. More...
 
void Start (TVector3 const &pt)
 Start setter. More...
 
template<class T >
void Start (T const &pos)
 Start setter template. More...
 
Vector_t const & Dir () const
 Direction getter. More...
 
void Dir (double const x, double const y, double const z)
 Dir setter. More...
 
void Dir (TVector3 const &dir)
 Dir setter. More...
 
template<class T >
void Dir (T const &dir)
 Dir setter template. More...
 

Protected Member Functions

void Normalize ()
 Normalize direction. More...
 

Protected Attributes

double _length
 Helight (length) of the cone. More...
 
double _radius
 Radius of the cone at the base. More...
 
double _angle
 Opening Angle. More...
 
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 3D cone with the following properties:
Start point (or vertex), Direction, Length (or Length), Radius, opening angle
When 2 of Length, Radius, opening angle are defined the third is automatically set.

Definition at line 27 of file GeoCone.h.

Constructor & Destructor Documentation

geoalgo::Cone::Cone ( )

Default constructor.

Definition at line 9 of file GeoCone.cxx.

References _angle, _length, and _radius.

Referenced by ~Cone().

9  : HalfLine()
10  {
11  _length = 1;
12  _radius = 1;
13  _angle = atan(_radius / _length);
14  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
double _angle
Opening Angle.
Definition: GeoCone.h:65
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:5
virtual geoalgo::Cone::~Cone ( )
inlinevirtual

Default destructor.

Definition at line 34 of file GeoCone.h.

References Angle(), Cone(), dir, Length(), r, radius, Radius(), x, y, and z.

34 {};
geoalgo::Cone::Cone ( double const  x,
double const  y,
double const  z,
double const  dirx,
double const  diry,
double const  dirz,
double const  length,
double const  radius 
)

Alternative ctor (1)

Definition at line 16 of file GeoCone.cxx.

References _angle, _length, _radius, and radius.

24  : HalfLine(x, y, z, dirx, diry, dirz)
25  {
26  if (length == 0) {
27  std::ostringstream msg;
28  msg << "<<" << __FUNCTION__ << ">>"
29  << " Cone Length cannot be 0." << std::endl;
30  throw GeoAlgoException(msg.str());
31  }
32  _length = length;
33  _radius = radius;
34  _angle = atan(_radius / _length);
35  }
Float_t x
Definition: compare.C:6
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
double _angle
Opening Angle.
Definition: GeoCone.h:65
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Float_t radius
Definition: plot.C:23
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:5
geoalgo::Cone::Cone ( Point_t const &  start,
Vector_t const &  dir,
double const  length,
double const  radius 
)

Alternative ctor (2)

Definition at line 37 of file GeoCone.cxx.

References _angle, _length, _radius, and radius.

38  : HalfLine(start, dir)
39  {
40  if (length == 0) {
41  std::ostringstream msg;
42  msg << "<<" << __FUNCTION__ << ">>"
43  << " Cone Length cannot be 0." << std::endl;
44  throw GeoAlgoException(msg.str());
45  }
46  _length = length;
47  _radius = radius;
48  _angle = atan(_radius / _length);
49  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
double _angle
Opening Angle.
Definition: GeoCone.h:65
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
Float_t radius
Definition: plot.C:23
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:5
TDirectory * dir
Definition: macro.C:5
template<class T , class U >
geoalgo::Cone::Cone ( T const &  start,
U const &  dir 
)
inline

Alternative ctor using template (3)

Definition at line 73 of file GeoCone.h.

73  : Cone(Point_t(start), Vector_t(dir))
74  {}
Cone()
Default constructor.
Definition: GeoCone.cxx:9
Vector Point_t
Definition: GeoVector.h:204
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:203

Member Function Documentation

double geoalgo::Cone::Angle ( ) const

Angle getter.

Definition at line 61 of file GeoCone.cxx.

References _angle.

Referenced by ~Cone().

62  {
63  return _angle;
64  }
double _angle
Opening Angle.
Definition: GeoCone.h:65
Vector_t const & geoalgo::HalfLine::Dir ( ) const
inherited

Direction getter.

Definition at line 33 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_dir.

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

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

Dir setter.

Definition at line 45 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_dir, geoalgo::HalfLine::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 ( TVector3 const &  dir)
inherited

Dir setter.

Definition at line 60 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_dir, and geoalgo::HalfLine::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 ( T const &  dir)
inlineinherited

Dir setter template.

Definition at line 85 of file GeoHalfLine.h.

References geoalgo::HalfLine::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
double geoalgo::Cone::Length ( ) const

Length getter.

Definition at line 51 of file GeoCone.cxx.

References _length.

Referenced by geoalgo::GeoObjCollection::Add(), and ~Cone().

52  {
53  return _length;
54  }
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
void geoalgo::Cone::Length ( double const  l)

Length setter.

Definition at line 66 of file GeoCone.cxx.

References _angle, _length, and _radius.

67  {
68  if (l == 0) {
69  std::ostringstream msg;
70  msg << "<<" << __FUNCTION__ << ">>"
71  << " Cone Length cannot be 0." << std::endl;
72  throw GeoAlgoException(msg.str());
73  }
74  _length = l;
75  _angle = atan(_radius / _length);
76  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
double _angle
Opening Angle.
Definition: GeoCone.h:65
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
void geoalgo::HalfLine::Normalize ( )
protectedinherited

Normalize direction.

Definition at line 68 of file GeoHalfLine.cxx.

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

Referenced by geoalgo::HalfLine::Dir(), geoalgo::HalfLine::HalfLine(), and geoalgo::HalfLine::~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
double geoalgo::Cone::Radius ( ) const

Length getter.

Definition at line 56 of file GeoCone.cxx.

References _radius.

Referenced by ~Cone().

57  {
58  return _radius;
59  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
void geoalgo::Cone::Radius ( double const  r)

Radius setter.

Definition at line 78 of file GeoCone.cxx.

References _angle, _length, _radius, and r.

79  {
80  _radius = r;
81  _angle = atan(_radius / _length);
82  }
TRandom r
Definition: spectrum.C:23
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:64
double _angle
Opening Angle.
Definition: GeoCone.h:65
double _length
Helight (length) of the cone.
Definition: GeoCone.h:63
void geoalgo::HalfLine::Start ( double const  x,
double const  y,
double const  z 
)
inherited

Start setter.

Definition at line 38 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_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 ( TVector3 const &  pt)
inherited

Start setter.

Definition at line 53 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_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 ( T const &  pos)
inlineinherited

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

double geoalgo::Cone::_angle
protected

Opening Angle.

Definition at line 65 of file GeoCone.h.

Referenced by Angle(), Cone(), Length(), and Radius().

Vector_t geoalgo::HalfLine::_dir
protectedinherited

Direction of the half line from _start.

Definition at line 62 of file GeoHalfLine.h.

Referenced by geoalgo::HalfLine::Dir(), and geoalgo::HalfLine::Normalize().

double geoalgo::Cone::_length
protected

Helight (length) of the cone.

Definition at line 63 of file GeoCone.h.

Referenced by Cone(), Length(), and Radius().

double geoalgo::Cone::_radius
protected

Radius of the cone at the base.

Definition at line 64 of file GeoCone.h.

Referenced by Cone(), Length(), and Radius().

Point_t geoalgo::HalfLine::_start
protectedinherited

Beginning of the half line.

Definition at line 61 of file GeoHalfLine.h.

Referenced by geoalgo::HalfLine::Start().


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