GeoCone.cxx
Go to the documentation of this file.
1 #include "larcorealg/GeoAlgo/GeoAlgoException.h" // for GeoAlgoException
3 
4 #include <math.h>
5 #include <sstream>
6 
7 namespace geoalgo {
8 
10  {
11  _length = 1;
12  _radius = 1;
13  _angle = atan(_radius/_length);
14  }
15 
16  Cone::Cone(const double x, const double y, const double z,
17  const double dirx, const double diry, const double dirz,
18  const double length, const double radius)
19  : HalfLine(x, y, z, dirx, diry, dirz)
20  {
21  if (length == 0){
22  std::ostringstream msg;
23  msg << "<<" << __FUNCTION__ << ">>"
24  << " Cone Length cannot be 0." << std::endl;
25  throw GeoAlgoException(msg.str());
26  }
27  _length = length;
28  _radius = radius;
29  _angle = atan(_radius/_length);
30  }
31 
32  Cone::Cone(const Point_t& start, const Vector_t& dir,
33  const double length, const double radius)
34  : HalfLine( start, dir )
35  {
36  if (length == 0){
37  std::ostringstream msg;
38  msg << "<<" << __FUNCTION__ << ">>"
39  << " Cone Length cannot be 0." << std::endl;
40  throw GeoAlgoException(msg.str());
41  }
42  _length = length;
43  _radius = radius;
44  _angle = atan(_radius/_length);
45  }
46 
47  double Cone::Length() const { return _length; }
48 
49  double Cone::Radius() const { return _radius; }
50 
51  double Cone::Angle() const { return _angle; }
52 
53  void Cone::Length(const double l)
54  {
55  if (l == 0){
56  std::ostringstream msg;
57  msg << "<<" << __FUNCTION__ << ">>"
58  << " Cone Length cannot be 0." << std::endl;
59  throw GeoAlgoException(msg.str());
60  }
61  _length = l;
62  _angle = atan(_radius/_length);
63  }
64 
65  void Cone::Radius(const double r) { _radius = r; _angle = atan(_radius/_length); }
66 }
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
void msg(const char *fmt,...)
Definition: message.cpp:107
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
Class def header for a class GeoAlgoException.
double Length() const
Length getter.
Definition: GeoCone.cxx:47
string dir
Class def header for a class HalfLine.
static QStrList * l
Definition: config.cpp:1044
Cone()
Default constructor.
Definition: GeoCone.cxx:9
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...
Definition: GeoHalfLine.h:30
double Angle() const
Angle getter.
Definition: GeoCone.cxx:51
list x
Definition: train.py:276
double Radius() const
Length getter.
Definition: GeoCone.cxx:49
QTextStream & endl(QTextStream &s)