HerdSoftware  0.4.0
Plane.h
Go to the documentation of this file.
1 /*
2  * Plane.h
3  *
4  * Created on: 31 May 2019
5  * Author: Lorenzo Pacini
6  */
7 
10 #ifndef HERD_PLANE_H_
11 #define HERD_PLANE_H_
12 
13 // HerdSoftware headers
18 #include <optional>
19 
20 #ifdef HS_USE_ROOT
21 #include "Rtypes.h"
22 #endif
23 
24 namespace Herd {
25 
29 class Plane {
30 public:
40  Plane(Point point, const float polar, const float azimuth);
41 
50  Plane(Point point, Vec3D normal) : _point{std::move(point)}, _normal{std::move(normal)} { _normal /= _normal.Mag(); }
51 
60  Plane(std::array<Point, 3> points);
61 
66  Plane();
67 
69  virtual ~Plane() = default;
70 
77  [[nodiscard]] inline float Polar() const { return _normal.PolarAngle(); };
78 
83  [[nodiscard]] inline float Azimuth() const { return _normal.AzimuthAngle(); };
84 
89  [[nodiscard]] Vec3D Normal() const { return _normal; };
90 
97  [[nodiscard]] Point Origin() const { return _point; };
98 
106  [[nodiscard]] std::optional<Point> Intersection(Line line) const;
107 
113  [[nodiscard]] double DistanceToPoint(const Point p) const;
114 
120  bool operator==(const Plane &rhs) const { return _point == rhs._point && _normal == rhs._normal; }
121 
122 private:
125 
126 #ifdef HS_USE_ROOT
127  ClassDef(Plane, 2)
128 #endif
129 };
130 
131 namespace {
132 template <> const Plane defaultValue<Plane> = Plane();
133 }
134 
135 } // namespace Herd
136 
137 #endif /* HERD_PLANE_H_ */
Herd::Plane::DistanceToPoint
double DistanceToPoint(const Point p) const
Computes the distance of a point to the plane.
Definition: Plane.cpp:61
Herd::Vec3D::Mag
float Mag() const
Compute the vector magnitude.
Definition: Vec3D.h:118
Herd::Plane
Class describing a Plane in the 3D space.
Definition: Plane.h:29
Point.h
Herd::Plane::_point
Point _point
Definition: Plane.h:123
Herd::Vec3D
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Herd::Plane::Normal
Vec3D Normal() const
Returns the normal to the plane.
Definition: Plane.h:89
Herd::Plane::~Plane
virtual ~Plane()=default
Virtual destructor
Herd::Plane::Azimuth
float Azimuth() const
Returns the azimuth angle of the plane.
Definition: Plane.h:83
Herd::Line
Class describing a line in the 3D space.
Definition: Line.h:37
Herd::Vec3D::AzimuthAngle
float AzimuthAngle() const
Compute the azimuth angle.
Definition: Vec3D.h:166
Vec3D.h
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Line.h
Herd::Plane::Plane
Plane()
Default constructor.
Definition: Plane.cpp:46
Herd::Vec3D::PolarAngle
float PolarAngle() const
Compute the polar angle.
Definition: Vec3D.h:156
Herd::Plane::_normal
Vec3D _normal
Definition: Plane.h:124
RefFrame.h
Herd::Plane::operator==
bool operator==(const Plane &rhs) const
Comparison operator.
Definition: Plane.h:120
Herd::Plane::Polar
float Polar() const
Returns the polar angle of the normal of the plane with respect to the NEGATIVE Z axis.
Definition: Plane.h:77
Herd::Plane::Origin
Point Origin() const
Returns the "point of origin" of the plane.
Definition: Plane.h:97
Herd::Plane::Intersection
std::optional< Point > Intersection(Line line) const
Returns the intersect between this plane and a Line If the plane and line are parallel,...
Definition: Plane.cpp:48
Herd::Plane::Plane
Plane(Point point, Vec3D normal)
Constructor.
Definition: Plane.h:50