Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-30 09:40:27

0001 // This file is part of the actsvg package.
0002 //
0003 // Copyright (C) 2022 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 "actsvg/core.hpp"
0012 
0013 namespace actsvg {
0014 
0015 namespace display {
0016 
0017 /// Find inner outer radius at edges in STRIP PC
0018 ///
0019 /// @note have a look at Acts/Surfaces/AnnulusBounds.hpp
0020 /// for more information
0021 ///
0022 static inline point2 annulusCircleIx(scalar O_x, scalar O_y, scalar r,
0023                                      scalar phi) {
0024     //                      _____________________________________________
0025     //                     /      2  2                    2    2  2    2
0026     //     O_x + O_y*m - \/  - O_x *m  + 2*O_x*O_y*m - O_y  + m *r  + r
0027     // x =
0028     // --------------------------------------------------------------
0029     //                                  2
0030     //                                 m  + 1
0031     //
0032     // y = m*x
0033     //
0034     scalar m = std::tan(phi);
0035     point2 dir = {std::cos(phi), std::sin(phi)};
0036     scalar x1 = static_cast<scalar>(
0037         (O_x + O_y * m -
0038          std::sqrt(-std::pow(O_x, 2) * std::pow(m, 2) + 2 * O_x * O_y * m -
0039                    std::pow(O_y, 2) + std::pow(m, 2) * std::pow(r, 2) +
0040                    std::pow(r, 2))) /
0041         (std::pow(m, 2) + 1));
0042     scalar x2 = static_cast<scalar>(
0043         (O_x + O_y * m +
0044          std::sqrt(-std::pow(O_x, 2) * std::pow(m, 2) + 2 * O_x * O_y * m -
0045                    std::pow(O_y, 2) + std::pow(m, 2) * std::pow(r, 2) +
0046                    std::pow(r, 2))) /
0047         (std::pow(m, 2) + 1));
0048 
0049     point2 v1 = {x1, m * x1};
0050     if (v1[0] * dir[0] + v1[1] * dir[1] > 0) {
0051         return v1;
0052     }
0053     return {x2, m * x2};
0054 };
0055 
0056 }  // namespace display
0057 }  // namespace actsvg