Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:12

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 #include "Acts/Definitions/Algebra.hpp"
0010 template <typename value_t, std::size_t DIM>
0011 Acts::Ray<value_t, DIM>::Ray(const VertexType& origin, const VertexType& dir)
0012     : m_origin(origin), m_dir(dir.normalized()), m_idir(1 / m_dir.array()) {}
0013 template <typename value_t, std::size_t DIM>
0014 std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const {
0015   os << "Ray(";
0016   for (std::size_t i = 0; i < DIM; i++) {
0017     if (i > 0) {
0018       os << ", ";
0019     }
0020     os << m_origin[i];
0021   }
0022   os << " -> ";
0023   for (std::size_t i = 0; i < DIM; i++) {
0024     if (i > 0) {
0025       os << ", ";
0026     }
0027     os << m_dir[i];
0028   }
0029   os << ")";
0030 
0031   return os;
0032 }
0033 
0034 template <typename value_t, std::size_t DIM>
0035 Acts::Ray<value_t, DIM> Acts::Ray<value_t, DIM>::transformed(
0036     const transform_type& trf) const {
0037   return Ray<value_t, DIM>(trf * m_origin, trf.rotation() * m_dir);
0038 }
0039 
0040 template <typename value_t, std::size_t DIM>
0041 void Acts::Ray<value_t, DIM>::draw(IVisualization3D& helper,
0042                                    value_type far_distance) const
0043   requires(DIM == 3)
0044 {
0045   static_assert(DIM == 3, "OBJ is only supported in 3D");
0046 
0047   helper.line(m_origin, (m_origin + m_dir * far_distance).eval());
0048 }
0049 
0050 template <typename U, std::size_t V>
0051 std::ostream& operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) {
0052   ray.dump(os);
0053   return os;
0054 }