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