LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 (const double x, const double y, const double z, const double dirx, const double diry, const double dirz, const double length, const double radius)
 Alternative ctor (1) More...
 
 Cone (const Point_t &start, const Vector_t &dir, const double length, const double 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 (const double l)
 Length setter. More...
 
void Radius (const double r)
 Radius setter. More...
 
template<class T , class U >
 Cone (const T &start, const U &dir)
 Alternative ctor using template (3) More...
 
const Point_tStart () const
 Start getter. More...
 
void Start (const double x, const double y, const double z)
 Start setter. More...
 
void Start (const TVector3 &pt)
 Start setter. More...
 
template<class T >
void Start (const T &pos)
 Start setter template. More...
 
const Vector_tDir () const
 Direction getter. More...
 
void Dir (const double x, const double y, const double z)
 Dir setter. More...
 
void Dir (const TVector3 &dir)
 Dir setter. More...
 
template<class T >
void Dir (const T &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 8 of file GeoCone.cxx.

References _angle, _length, and _radius.

Referenced by ~Cone().

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

Default destructor.

Definition at line 35 of file GeoCone.h.

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

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

Alternative ctor (1)

Definition at line 15 of file GeoCone.cxx.

References _angle, _length, _radius, and radius.

18  : HalfLine(x, y, z, dirx, diry, dirz)
19  {
20  if (length == 0){
21  std::ostringstream msg;
22  msg << "<<" << __FUNCTION__ << ">>"
23  << " Cone Length cannot be 0." << std::endl;
24  throw GeoAlgoException(msg.str());
25  }
26  _length = length;
27  _radius = radius;
28  _angle = atan(_radius/_length);
29  }
Float_t x
Definition: compare.C:6
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Double_t radius
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:7
geoalgo::Cone::Cone ( const Point_t start,
const Vector_t dir,
const double  length,
const double  radius 
)

Alternative ctor (2)

Definition at line 31 of file GeoCone.cxx.

References _angle, _length, _radius, and radius.

33  : HalfLine( start, dir )
34  {
35  if (length == 0){
36  std::ostringstream msg;
37  msg << "<<" << __FUNCTION__ << ">>"
38  << " Cone Length cannot be 0." << std::endl;
39  throw GeoAlgoException(msg.str());
40  }
41  _length = length;
42  _radius = radius;
43  _angle = atan(_radius/_length);
44  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
Double_t radius
HalfLine()
Default constructor.
Definition: GeoHalfLine.cxx:7
TDirectory * dir
Definition: macro.C:5
template<class T , class U >
geoalgo::Cone::Cone ( const T &  start,
const U &  dir 
)
inline

Alternative ctor using template (3)

Definition at line 70 of file GeoCone.h.

71  : Cone(Point_t(start), Vector_t(dir))
72  {}
Cone()
Default constructor.
Definition: GeoCone.cxx:8
Vector Point_t
Definition: GeoVector.h:200
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199

Member Function Documentation

double geoalgo::Cone::Angle ( ) const

Angle getter.

Definition at line 50 of file GeoCone.cxx.

References _angle.

Referenced by ~Cone().

50 { return _angle; }
double _angle
Opening Angle.
Definition: GeoCone.h:63
const Vector_t & geoalgo::HalfLine::Dir ( ) const
inherited
void geoalgo::HalfLine::Dir ( const double  x,
const double  y,
const double  z 
)
inherited

Dir setter.

Definition at line 34 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_dir, geoalgo::HalfLine::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)
inherited

Dir setter.

Definition at line 40 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_dir, and geoalgo::HalfLine::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)
inlineinherited

Dir setter template.

Definition at line 79 of file GeoHalfLine.h.

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

Length getter.

Definition at line 46 of file GeoCone.cxx.

References _length.

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

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

Length setter.

Definition at line 52 of file GeoCone.cxx.

References _angle, _length, and _radius.

53  {
54  if (l == 0){
55  std::ostringstream msg;
56  msg << "<<" << __FUNCTION__ << ">>"
57  << " Cone Length cannot be 0." << std::endl;
58  throw GeoAlgoException(msg.str());
59  }
60  _length = l;
61  _angle = atan(_radius/_length);
62  }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
void geoalgo::HalfLine::Normalize ( )
protectedinherited

Normalize direction.

Definition at line 43 of file GeoHalfLine.cxx.

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

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

Length getter.

Definition at line 48 of file GeoCone.cxx.

References _radius.

Referenced by ~Cone().

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

Radius setter.

Definition at line 64 of file GeoCone.cxx.

References _angle, _length, and _radius.

64 { _radius = r; _angle = atan(_radius/_length); }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
void geoalgo::HalfLine::Start ( const double  x,
const double  y,
const double  z 
)
inherited

Start setter.

Definition at line 31 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_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)
inherited

Start setter.

Definition at line 37 of file GeoHalfLine.cxx.

References geoalgo::HalfLine::_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)
inlineinherited

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

double geoalgo::Cone::_angle
protected

Opening Angle.

Definition at line 63 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 56 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 61 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 62 of file GeoCone.h.

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

Point_t geoalgo::HalfLine::_start
protectedinherited

Beginning of the half line.

Definition at line 55 of file GeoHalfLine.h.

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


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