HerdSoftware  0.4.0
Parallelepiped.h
Go to the documentation of this file.
1 /*
2  * Parallelepiped.h
3  *
4  * Created on: 2 Feb 2023
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_PARALLELEPIPED_H
11 #define HERD_PARALLELEPIPED_H
12 
14 
15 #ifdef HS_USE_ROOT
16 #include "Rtypes.h"
17 #endif
18 
19 namespace Herd {
26  friend bool operator==(const Parallelepiped &lhs, const Parallelepiped &rhs);
27 
28 public:
34 
36  virtual ~Parallelepiped() = default;
37 
46  Parallelepiped(std::array<Point, 4> points);
47 
54  [[nodiscard]] std::array<Point, 8> Vertices() const;
55 
62  [[nodiscard]] const std::array<Parallelogram, 6> &Faces() const;
63 
69  [[nodiscard]] std::optional<std::array<Point, 2>> Intersections(const Line &line) const;
70 
75  [[nodiscard]] bool Contains(const Point &point) const;
76 
77 protected:
79  std::array<Vec3D, 3> m_sides; // Vectors describing the main sides w.r.t. the origin of the solid
80  mutable std::array<Parallelogram, 6> m_faces;
81  mutable bool m_facesAreValid{false};
82 
83 #ifdef HS_USE_ROOT
84  ClassDef(Parallelepiped, 1)
85 #endif
86 };
87 
88 inline bool operator==(const Parallelepiped &lhs, const Parallelepiped &rhs) {
89  return (lhs.m_origin == rhs.m_origin) && (lhs.m_sides == rhs.m_sides);
90 }
91 
92 } // namespace Herd
93 
94 #endif // HERD_PARALLELEPIPED_H
Herd::Parallelepiped::Contains
bool Contains(const Point &point) const
Checks if the parallelepiped contains the given point.
Definition: Parallelepiped.cpp:104
Herd::Vec3D
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Herd::operator==
bool operator==(const HoughTrackStub &lhs, const HoughTrackStub &rhs)
Definition: HoughTrackStub.h:41
Herd::Parallelepiped::m_sides
std::array< Vec3D, 3 > m_sides
Definition: Parallelepiped.h:79
Herd::Parallelepiped::~Parallelepiped
virtual ~Parallelepiped()=default
Destructor.
Parallelogram.h
Herd::Line
Class describing a line in the 3D space.
Definition: Line.h:37
Herd::Parallelepiped::Intersections
std::optional< std::array< Point, 2 > > Intersections(const Line &line) const
Computes the intersection points of the given line with the parallelepiped.
Definition: Parallelepiped.cpp:67
Herd::Parallelepiped::m_faces
std::array< Parallelogram, 6 > m_faces
! Faces of the parallelepiped
Definition: Parallelepiped.h:80
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::Parallelepiped::m_facesAreValid
bool m_facesAreValid
! Check if we already computed the faces
Definition: Parallelepiped.h:81
Herd::Parallelepiped::m_origin
Herd::Point m_origin
Definition: Parallelepiped.h:78
Herd::Parallelepiped::operator==
friend bool operator==(const Parallelepiped &lhs, const Parallelepiped &rhs)
Definition: Parallelepiped.h:88
Herd::Parallelepiped::Faces
const std::array< Parallelogram, 6 > & Faces() const
Gets the faces of the parallelepiped.
Definition: Parallelepiped.cpp:45
Herd::Parallelepiped::Parallelepiped
Parallelepiped()
Definition: Parallelepiped.cpp:16
Herd::Parallelepiped::Vertices
std::array< Point, 8 > Vertices() const
Gets the vertices of the parallelepiped.
Definition: Parallelepiped.cpp:33
Herd::Parallelepiped
A parallelepiped in 3D space.
Definition: Parallelepiped.h:25