HerdSoftware  0.4.0
Trapezium.h
Go to the documentation of this file.
1 /*
2  * Trapezium.h
3  *
4  * Created on: 8 Feb 2023
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_TRAPEZIUM_H_
11 #define HERD_TRAPEZIUM_H_
12 
15 
16 #ifdef HS_USE_ROOT
17 #include "Rtypes.h"
18 #endif
19 
25 namespace Herd {
26 class Trapezium {
27 public:
32  Trapezium() = default;
33 
35  virtual ~Trapezium() = default;
36 
46  Trapezium(std::array<Point, 4> points);
47 
54  [[nodiscard]] Herd::Plane Plane() const { return m_plane; };
55 
62  [[nodiscard]] std::array<Point, 4> Vertices() const;
63 
71  [[nodiscard]] std::optional<Point> Intersection(const Line &line) const;
72 
80  [[nodiscard]] virtual bool Contains(Point point) const;
81 
87  bool operator==(const Trapezium &rhs) const { return m_plane == rhs.m_plane && m_vertices == rhs.m_vertices; }
88 
89  bool operator!=(const Trapezium &rhs) const { return !operator==(rhs); }
90 
91 protected:
92  Herd::Plane m_plane; // The origin of this plane lies on one vertex of the Trapezium
93  std::array<Vec3D, 3> m_vertices; // Coordinates of the vertices w.r.t. the origin of the plane
94 
95 #ifdef HS_USE_ROOT
96  ClassDef(Trapezium, 1)
97 #endif
98 };
99 } // namespace Herd
100 
101 #endif // HERD_TRAPEZE_H_
Herd::Plane
Class describing a Plane in the 3D space.
Definition: Plane.h:29
Point.h
Herd::Vec3D
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Herd::Trapezium::Trapezium
Trapezium()=default
Herd::Trapezium::operator==
bool operator==(const Trapezium &rhs) const
Comparison operator.
Definition: Trapezium.h:87
Herd::Line
Class describing a line in the 3D space.
Definition: Line.h:37
Herd::Trapezium::Intersection
std::optional< Point > Intersection(const Line &line) const
Computes the intersection point of the given line with the Trapezium.
Definition: Trapezium.cpp:79
Plane.h
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::Trapezium::Contains
virtual bool Contains(Point point) const
Checks if the Trapezium contains the given point.
Definition: Trapezium.cpp:54
Herd::Trapezium
Definition: Trapezium.h:26
Herd::Trapezium::Plane
Herd::Plane Plane() const
Gets the plane on which the Trapezium lies.
Definition: Trapezium.h:54
Herd::Trapezium::m_vertices
std::array< Vec3D, 3 > m_vertices
Definition: Trapezium.h:93
Herd::Trapezium::~Trapezium
virtual ~Trapezium()=default
Destructor.
Herd::Trapezium::m_plane
Herd::Plane m_plane
Definition: Trapezium.h:92
Herd::Trapezium::Vertices
std::array< Point, 4 > Vertices() const
Gets the vertices of the Trapezium.
Definition: Trapezium.cpp:49
Herd::Trapezium::operator!=
bool operator!=(const Trapezium &rhs) const
Definition: Trapezium.h:89