Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:50

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Utilities/Intersection.hpp"
0013 
0014 #include <array>
0015 
0016 namespace Acts::detail {
0017 
0018 struct IntersectionHelper2D {
0019   /// Intersect two segments
0020   ///
0021   /// @param s0 The Start of the segment
0022   /// @param s1 The end of the segment
0023   /// @param origin The Start of intersection line
0024   /// @param dir The Direction of intersection line
0025   ///
0026   /// @return the intersection point with status
0027   static Intersection2D intersectSegment(const Vector2& s0, const Vector2& s1,
0028                                          const Vector2& origin,
0029                                          const Vector2& dir,
0030                                          bool boundCheck = false);
0031 
0032   /// Intersect ellipses
0033   ///
0034   /// @param Rx The radius in x
0035   /// @param Ry The radius in y
0036   /// @param origin The Start of intersection line
0037   /// @param dir The Direction of intersection line
0038   ///
0039   /// @return the intersection points
0040   static std::array<Intersection2D, 2> intersectEllipse(ActsScalar Rx,
0041                                                         ActsScalar Ry,
0042                                                         const Vector2& origin,
0043                                                         const Vector2& dir);
0044 
0045   /// Intersect the circle
0046   ///
0047   /// @param R The radius
0048   /// @param origin The Start of intersection line
0049   /// @param dir The Direction of intersection line
0050   ///
0051   /// @return the intersection points
0052   static inline std::array<Intersection2D, 2> intersectCircle(
0053       ActsScalar R, const Vector2& origin, const Vector2& dir) {
0054     return intersectEllipse(R, R, origin, dir);
0055   }
0056 
0057   /// Intersect a circle segment
0058   ///
0059   /// @note only forward solution is taken
0060   ///
0061   /// @param R The radius
0062   /// @param phiMin The minimum phi value
0063   /// @param phiMax The maximum phi value
0064   /// @param origin The Start of intersection line
0065   /// @param dir The Direction of intersection line
0066   ///
0067   /// @return the intersection points
0068   static Intersection2D intersectCircleSegment(ActsScalar R, ActsScalar phiMin,
0069                                                ActsScalar phiMax,
0070                                                const Vector2& origin,
0071                                                const Vector2& dir);
0072 
0073 };  // struct IntersectionHelper2D
0074 
0075 }  // namespace Acts::detail