HerdSoftware  0.3.2
Parallelogram.h
Go to the documentation of this file.
1 /*
2  * Parallelogram.h
3  *
4  * Created on: 9 Sep 2020
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_PARALLELOGRAM_H_
11 #define HERD_PARALLELOGRAM_H_
12 
13 #include "dataobjects/Plane.h"
14 #include "dataobjects/Point.h"
15 
16 #ifdef HS_USE_ROOT
17 #include "Rtypes.h"
18 #endif
19 
20 #include <array>
21 
22 namespace Herd {
23 
30 
31 public:
36  Parallelogram();
37 
39  virtual ~Parallelogram() = default;
40 
49  Parallelogram(std::array<Point, 3> points);
50 
57  Herd::Plane Plane() const;
58 
65  std::array<Point, 4> Vertices() const;
66 
74  Point Intersection(const Line &line) const;
75 
83  bool Contains(const Point &point) const;
84 
90  bool operator==(const Parallelogram &rhs) const { return _plane == rhs._plane && _vertices == rhs._vertices; }
91 
92  bool operator!=(const Parallelogram &rhs) const { return !operator==(rhs); }
93 
94 protected:
95  Herd::Plane _plane; // The origin of this plane lies on one vertex of the parallelogram
96  std::array<Vec3D, 2> _vertices; // Coordinates of two vertices w.r.t. the origin of the plane
97 
98 #ifdef HS_USE_ROOT
99  ClassDef(Parallelogram, 1)
100 #endif
101 };
102 
103 } // namespace Herd
104 
105 #endif /* RECTANGLE_H_ */
bool operator!=(const Parallelogram &rhs) const
Definition: Parallelogram.h:92
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
Point Intersection(const Line &line) const
Computes the intersection point of the given line with the parallelogram.
Definition: Parallelogram.cpp:41
Herd::Plane _plane
Definition: Parallelogram.h:95
bool Contains(const Point &point) const
Checks if the parallelogram contains the given point.
Definition: Parallelogram.cpp:53
A class describing a vector in 3D space.
Definition: Vec3D.h:33
Class describing a line in the 3D space.
Definition: Line.h:34
bool operator==(const Parallelogram &rhs) const
Comparison operator.
Definition: Parallelogram.h:90
Herd::Plane Plane() const
Gets the plane on which the parallelogram lies.
Definition: Parallelogram.cpp:34
A parallelogram in 3D space.
Definition: Parallelogram.h:29
std::array< Point, 4 > Vertices() const
Gets the vertices of the parallelogram.
Definition: Parallelogram.cpp:36
Class describing a Plane in the 3D space.
Definition: Plane.h:28
std::array< Vec3D, 2 > _vertices
Definition: Parallelogram.h:96
virtual ~Parallelogram()=default
Destructor.