HerdSoftware  0.1.1
Line.h
Go to the documentation of this file.
1 /*
2  * Line.h
3  *
4  * Created on: 19 Oct 2018
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_LINE_H_
11 #define HERD_LINE_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 "common/Vec3D.h"
22 #include "dataobjects/Line2D.h"
23 #include "dataobjects/Point.h"
24 
25 namespace Herd {
26 
27 class Plane;
28 
32 class Line {
33 public:
38 
47  Line(const Point &point, const float polar, const float azimuth);
48 
56  Line(const Point &point, const Vec3D &direction);
57 
67  Line(const Line2D &proj1, RefFrame::View view1, const Line2D &proj2, RefFrame::View view2);
68 
70  virtual ~Line() = default;
71 
78  inline float Polar() const { return _polar; };
79 
87  float Azimuth() const;
88 
95  Point Origin() const { return _point; };
96 
101  Vec3D Direction() const;
102 
110  Point Intersection(RefFrame::Axis axis, float coo) const;
111 
119  Point Intersection(const Line &line) const;
120 
126  Line Projection(const Plane &plane) const;
127 
134  Line Projection(const Point p, RefFrame::View view) const;
135 
141  Line2D Projection2D(RefFrame::View view) const;
142 
148  double DistanceToPoint(const Point p) const;
149 
155  double MinimumDistanceToLine(const Line line) const;
156 
158  class ParallelToZ : public Exception {
159  public:
160  using Exception::Exception;
161  };
162 
163 private:
165  float _polar;
166  float _azimuth;
167 
168 #ifdef HS_USE_ROOT
169  ClassDef(Line, 1)
170 #endif
171 };
172 
173 } // namespace Herd
174 
175 #endif /* HERD_LINE_H_ */
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
Exception(std::string msg="")
Definition: Exception.h:30
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
Line2D Projection2D(RefFrame::View view) const
Computes the 2D projection of the line on a given view.
Definition: Line.cpp:290
float Polar() const
Returns the polar angle of the line with respect to the NEGATIVE Z axis.
Definition: Line.h:78
Vec3D Direction() const
Returns direction of the line.
Definition: Line.cpp:199
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
double MinimumDistanceToLine(const Line line) const
Computes the minimum distance between two lines.
Definition: Line.cpp:251
Point Origin() const
Returns the "point of origin" of the line.
Definition: Line.h:95
float _azimuth
Definition: Line.h:166
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Class describing a line in the 3D space.
Definition: Line.h:32
virtual ~Line()=default
Virtual destructor.
Line Projection(const Plane &plane) const
Computes the projection of the line on a given plane.
Definition: Line.cpp:261
Point _point
Definition: Line.h:164
double DistanceToPoint(const Point p) const
Computes the distance of a point to the line.
Definition: Line.cpp:245
Line()
Default Constructor.
Definition: Line.h:37
Point Intersection(RefFrame::Axis axis, float coo) const
Returns the line coordinate at given plane, defined by its normal axis and the coordinate along that ...
Definition: Line.cpp:211
Definition: Exception.h:24
float _polar
Definition: Line.h:165
Exception class for invalid operations on a line parallel to the Z axis.
Definition: Line.h:158
float Azimuth() const
Returns the azimuth angle of the line.
Definition: Line.cpp:192
View
Aliases for the three 2D projection planes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:88
Class describing a Plane in the 3D space.
Definition: Plane.h:28