File indexing completed on 2025-01-18 09:11:03
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/RectangleBounds.hpp"
0015 #include "Acts/Surfaces/SurfaceBounds.hpp"
0016
0017 #include <algorithm>
0018 #include <array>
0019 #include <iosfwd>
0020 #include <vector>
0021
0022 namespace Acts {
0023
0024
0025
0026
0027
0028 class DiamondBounds : public PlanarBounds {
0029 public:
0030 enum BoundValues {
0031 eHalfLengthXnegY = 0,
0032 eHalfLengthXzeroY = 1,
0033 eHalfLengthXposY = 2,
0034 eHalfLengthYneg = 3,
0035 eHalfLengthYpos = 4,
0036 eSize = 5
0037 };
0038
0039
0040
0041
0042
0043
0044
0045
0046 DiamondBounds(double halfXnegY, double halfXzeroY, double halfXposY,
0047 double halfYneg, double halfYpos) noexcept(false)
0048 : m_values({halfXnegY, halfXzeroY, halfXposY, halfYneg, halfYpos}),
0049 m_boundingBox(
0050 Vector2{
0051 -(*std::max_element(m_values.begin(), m_values.begin() + 2)),
0052 -halfYneg},
0053 Vector2{*std::max_element(m_values.begin(), m_values.begin() + 2),
0054 halfYpos}) {
0055 checkConsistency();
0056 }
0057
0058
0059
0060
0061 DiamondBounds(const std::array<double, eSize>& values) noexcept(false)
0062 : m_values(values),
0063 m_boundingBox(
0064 Vector2{-(*std::max_element(values.begin(), values.begin() + 2)),
0065 -values[eHalfLengthYneg]},
0066 Vector2{*std::max_element(values.begin(), values.begin() + 2),
0067 values[eHalfLengthYpos]}) {}
0068
0069 BoundsType type() const final { return SurfaceBounds::eDiamond; }
0070
0071
0072
0073
0074 std::vector<double> values() const final;
0075
0076
0077
0078
0079
0080
0081
0082
0083 bool inside(const Vector2& lposition,
0084 const BoundaryTolerance& boundaryTolerance) const final;
0085
0086
0087
0088
0089
0090
0091
0092 std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0093
0094
0095 const RectangleBounds& boundingBox() const final;
0096
0097
0098
0099
0100 std::ostream& toStream(std::ostream& sl) const final;
0101
0102
0103
0104 double get(BoundValues bValue) const { return m_values[bValue]; }
0105
0106 private:
0107 std::array<double, eSize> m_values;
0108 RectangleBounds m_boundingBox;
0109
0110
0111
0112 void checkConsistency() noexcept(false);
0113 };
0114
0115 }