File indexing completed on 2025-01-18 09:11:04
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0013 #include "Acts/Surfaces/PlanarBounds.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.hpp"
0015
0016 #include <array>
0017 #include <iosfwd>
0018 #include <vector>
0019
0020 namespace Acts {
0021
0022
0023
0024
0025
0026
0027
0028
0029 class RectangleBounds : public PlanarBounds {
0030 public:
0031 enum BoundValues : int {
0032 eMinX = 0,
0033 eMinY = 1,
0034 eMaxX = 2,
0035 eMaxY = 3,
0036 eSize = 4
0037 };
0038
0039
0040
0041
0042
0043 RectangleBounds(double halfX, double halfY) noexcept(false)
0044 : m_min({-halfX, -halfY}), m_max({halfX, halfY}) {
0045 checkConsistency();
0046 }
0047
0048
0049
0050
0051 RectangleBounds(const std::array<double, eSize>& values) noexcept(false)
0052 : m_min({values[eMinX], values[eMinY]}),
0053 m_max({values[eMaxX], values[eMaxY]}) {
0054 checkConsistency();
0055 }
0056
0057
0058
0059
0060
0061 RectangleBounds(const Vector2& min, const Vector2& max) noexcept(false)
0062 : m_min(min), m_max(max) {
0063 checkConsistency();
0064 }
0065
0066 BoundsType type() const final { return SurfaceBounds::eRectangle; }
0067
0068 std::vector<double> values() const final {
0069 return {m_min.x(), m_min.y(), m_max.x(), m_max.y()};
0070 }
0071
0072
0073
0074
0075
0076
0077
0078
0079 bool inside(const Vector2& lposition,
0080 const BoundaryTolerance& boundaryTolerance) const final;
0081
0082
0083
0084
0085
0086
0087
0088
0089 std::vector<Vector2> vertices(unsigned int quarterSegments = 0u) const final;
0090
0091
0092 const RectangleBounds& boundingBox() const final;
0093
0094
0095
0096
0097 std::ostream& toStream(std::ostream& sl) const final;
0098
0099
0100
0101 double get(BoundValues bValue) const;
0102
0103
0104 double halfLengthX() const { return 0.5 * (m_max.x() - m_min.x()); }
0105
0106
0107 double halfLengthY() const { return 0.5 * (m_max.y() - m_min.y()); }
0108
0109
0110
0111 const Vector2& min() const { return m_min; }
0112
0113
0114
0115 const Vector2& max() const { return m_max; }
0116
0117 private:
0118 Vector2 m_min;
0119 Vector2 m_max;
0120
0121
0122
0123 void checkConsistency() noexcept(false);
0124 };
0125
0126 }