ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
trajectory.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/algebra.hpp"
13#include "detray/tracks/ray.hpp"
14
15// Detray plugins include(s)
16#include "detray/plugins/svgtools/meta/proto/trajectory.hpp"
17#include "detray/plugins/svgtools/styling/styling.hpp"
18
19// System include(s)
20#include <vector>
21
22namespace detray::svgtools::conversion {
23
25template <concepts::point3D point3_t>
26inline auto trajectory(const std::vector<point3_t>& points,
27 const styling::trajectory_style& style =
29 using p_trajectory_t = svgtools::meta::proto::trajectory<point3_t>;
30 p_trajectory_t p_trajectory;
31
32 p_trajectory._points = points;
33
34 svgtools::styling::apply_style(p_trajectory, style);
35
36 return p_trajectory;
37}
38
45template <template <typename> class trajectory_t, concepts::algebra algebra_t>
46inline auto trajectory(const trajectory_t<algebra_t>& traj,
47 const styling::trajectory_style& style =
49 const dscalar<algebra_t> path_length = 500.f,
50 const dscalar<algebra_t> step_size = 1.f) {
51 const dscalar<algebra_t> S0 = 0.f;
52 std::vector<dpoint3D<algebra_t>> points;
53 for (auto s = S0; s < path_length; s += step_size) {
54 points.push_back(traj.pos(s));
55 }
56
57 return trajectory(points, style);
58}
59
65template <concepts::algebra algebra_t>
66inline auto trajectory(const detray::detail::ray<algebra_t>& traj,
67 const styling::trajectory_style& style =
69 const dscalar<algebra_t> path_length = 500.f) {
70 const dscalar<algebra_t> S0 = 0.f;
71 std::vector<dpoint3D<algebra_t>> points = {traj.pos(S0),
72 traj.pos(path_length)};
73
74 return trajectory(points, style);
75}
76
77} // namespace detray::svgtools::conversion
const point3_type & pos() const
Return the ray origin.
Definition ray.hpp:63
constexpr double s
Definition Units.hpp:120
const styling::trajectory_style trajectory_style
Default trajectory style.
Definition styling.hpp:258
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64