File indexing completed on 2025-07-11 07:50:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Utilities/Ray.hpp"
0012
0013 template <typename value_t, std::size_t DIM>
0014 Acts::Ray<value_t, DIM>::Ray(const VertexType& origin, const VertexType& dir)
0015 : m_origin(origin), m_dir(dir.normalized()), m_idir(1 / m_dir.array()) {}
0016 template <typename value_t, std::size_t DIM>
0017 std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const {
0018 os << "Ray(";
0019 for (std::size_t i = 0; i < DIM; i++) {
0020 if (i > 0) {
0021 os << ", ";
0022 }
0023 os << m_origin[i];
0024 }
0025 os << " -> ";
0026 for (std::size_t i = 0; i < DIM; i++) {
0027 if (i > 0) {
0028 os << ", ";
0029 }
0030 os << m_dir[i];
0031 }
0032 os << ")";
0033
0034 return os;
0035 }
0036
0037 template <typename value_t, std::size_t DIM>
0038 Acts::Ray<value_t, DIM> Acts::Ray<value_t, DIM>::transformed(
0039 const transform_type& trf) const {
0040 return Ray<value_t, DIM>(trf * m_origin, trf.rotation() * m_dir);
0041 }
0042
0043 template <typename value_t, std::size_t DIM>
0044 void Acts::Ray<value_t, DIM>::draw(IVisualization3D& helper,
0045 value_type far_distance) const
0046 requires(DIM == 3)
0047 {
0048 static_assert(DIM == 3, "OBJ is only supported in 3D");
0049
0050 helper.line(m_origin, (m_origin + m_dir * far_distance).eval());
0051 }
0052
0053 template <typename U, std::size_t V>
0054 std::ostream& operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) {
0055 ray.dump(os);
0056 return os;
0057 }