|
|
|||
File indexing completed on 2025-10-27 07:55:23
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 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 <array> 0017 #include <iosfwd> 0018 #include <numbers> 0019 #include <vector> 0020 0021 namespace Acts { 0022 0023 /// @class EllipseBounds 0024 /// 0025 /// @image html EllipseBounds.png 0026 /// 0027 /// Class to describe the bounds for a planar ellispoid 0028 /// surface. 0029 /// 0030 /// By providing an argument for hphisec, the bounds can 0031 /// be restricted to a phi-range around the center position. 0032 class EllipseBounds : public PlanarBounds { 0033 public: 0034 /// @enum BoundValues 0035 /// Enumeration for the bound values 0036 enum BoundValues { 0037 eInnerRx = 0, 0038 eInnerRy = 1, 0039 eOuterRx = 2, 0040 eOuterRy = 3, 0041 eHalfPhiSector = 4, 0042 eAveragePhi = 5, 0043 eSize = 6 0044 }; 0045 0046 /// Constructor for full of an ellipsoid ring 0047 /// 0048 /// @param innerRx The inner ellipse radius in x 0049 /// @param innerRy The inner ellipse radius in y 0050 /// @param outerRx The outer ellipse radius in x 0051 /// @param outerRy The outer ellipse radius in y 0052 /// @param halfPhi spanning phi sector (is set to pi as default) 0053 /// @param averagePhi average phi (is set to 0. as default) 0054 explicit EllipseBounds(double innerRx, double innerRy, double outerRx, 0055 double outerRy, double halfPhi = std::numbers::pi, 0056 double averagePhi = 0.) noexcept(false) 0057 : m_values({innerRx, innerRy, outerRx, outerRy, halfPhi, averagePhi}), 0058 m_boundingBox(m_values[eInnerRy], m_values[eOuterRy]) { 0059 checkConsistency(); 0060 } 0061 0062 /// Constructor - from fixed size array 0063 /// 0064 /// @param values The parameter values 0065 explicit EllipseBounds(const std::array<double, eSize>& values) noexcept( 0066 false) 0067 : m_values(values), m_boundingBox(values[eInnerRy], values[eOuterRy]) { 0068 checkConsistency(); 0069 } 0070 0071 /// @copydoc SurfaceBounds::type 0072 BoundsType type() const final { return eEllipse; } 0073 0074 /// Return the bound values as dynamically sized vector 0075 /// 0076 /// @return this returns a copy of the internal values 0077 std::vector<double> values() const final; 0078 0079 /// @copydoc SurfaceBounds::inside 0080 bool inside(const Vector2& lposition) const final; 0081 0082 /// @copydoc SurfaceBounds::closestPoint 0083 Vector2 closestPoint(const Vector2& lposition, 0084 const SquareMatrix2& metric) const final; 0085 0086 using SurfaceBounds::inside; 0087 0088 /// @copydoc SurfaceBounds::center 0089 Vector2 center() const final; 0090 0091 /// Return the vertices 0092 /// 0093 /// @param quarterSegments is the number of segments to approximate a quarter 0094 /// of a circle. In order to symmetrize fully closed and sectoral cylinders, 0095 /// also in the first case the two end points are given (albeit they overlap) 0096 /// in -pi / pi 0097 /// 0098 /// @return vector for vertices in 2D 0099 std::vector<Vector2> vertices(unsigned int quarterSegments) const final; 0100 0101 // Bounding box representation 0102 const RectangleBounds& boundingBox() const final; 0103 0104 /// Output Method for std::ostream 0105 /// @param sl The output stream to write to 0106 /// @return Reference to the output stream after writing 0107 std::ostream& toStream(std::ostream& sl) const final; 0108 0109 /// Access to the bound values 0110 /// @param bValue the class nested enum for the array access 0111 /// @return Value of the specified bound parameter 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 /// Check the input values for consistency, will throw a logic_exception 0119 /// if consistency is not given 0120 void checkConsistency() noexcept(false); 0121 }; 0122 0123 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|