HerdSoftware  0.1.1
Line2D.h
Go to the documentation of this file.
1 /*
2  * Line2D.h
3  *
4  * Created on: 18 Dec 2018
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_LINE2D_H_
11 #define HERD_LINE2D_H_
12 
13 #ifdef HS_USE_ROOT
14 #include "Rtypes.h"
15 #endif
16 
17 // HerdSoftware headers
18 #include "common/DefaultValues.h"
19 #include "common/Exception.h"
20 #include "common/RefFrame.h"
21 #include "dataobjects/Point.h"
22 
23 namespace Herd {
24 
32 class Line2D {
33 public:
40 
50  Line2D(const Point &point, float polar);
51 
60  Line2D(const Point &point);
61 
63  virtual ~Line2D() = default;
64 
73  float Polar() const;
74 
81  inline Point Origin() const { return _point; };
82 
93  Point Intersection(float coo, RefFrame::Axis axis) const;
94 
100  inline bool IsDegenerate() const { return std::isnan(_polar); }
101 
103  class Degenerate : public Exception {
104  public:
105  using Exception::Exception;
106  };
107 
108 private:
110  float _polar;
111 
112 #ifdef HS_USE_ROOT
113  ClassDef(Line2D, 1)
114 #endif
115 };
116 
117 } // namespace Herd
118 
119 #endif /* HERD_LINE2D_H_ */
Point Origin() const
Returns a point on the line.
Definition: Line2D.h:81
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
bool IsDegenerate() const
Checks if the line is degenerate.
Definition: Line2D.h:100
Exception(std::string msg="")
Definition: Exception.h:30
virtual ~Line2D()=default
Virtual destructor.
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
Point Intersection(float coo, RefFrame::Axis axis) const
Returns the line intersection with a given line parallel to one of the main axes, passing for a given...
Definition: Line2D.cpp:36
Exception class for invalid operations on a degenerate line.
Definition: Line2D.h:103
Axis
Aliases for the axes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:31
Class describing a line in the 2D space.
Definition: Line2D.h:32
A class describing a vector in 3D space.
Definition: Vec3D.h:33
float _polar
Definition: Line2D.h:110
Line2D()
Default constructor.
Definition: Line2D.h:39
Point _point
Definition: Line2D.h:109
Definition: Exception.h:24
float Polar() const
Returns the angle of the line with respect to the positive abscissa.
Definition: Line2D.cpp:29