12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/containers.hpp"
14#include "detray/definitions/detail/qualifiers.hpp"
15#include "detray/definitions/indexing.hpp"
16#include "detray/definitions/math.hpp"
17#include "detray/definitions/units.hpp"
18#include "detray/geometry/coordinates/concentric_cylindrical2D.hpp"
19#include "detray/geometry/detail/shape_utils.hpp"
35 static constexpr std::string_view
name =
"concentric_cylinder2D";
46 template <concepts::scalar scalar_t>
50 template <concepts::algebra algebra_t>
54 template <
typename bool_t>
58 static constexpr std::size_t
dim{2u};
69 template <concepts::scalar scalar_t, concepts::po
int po
int_t>
72 return math::min(math::fabs(loc_p[1] - bounds[e_lower_z]),
73 math::fabs(bounds[e_upper_z] - loc_p[1]));
83 template <concepts::algebra algebra_t>
111 template <concepts::scalar scalar_t, concepts::po
int po
int_t>
114 const scalar_t tol = std::numeric_limits<scalar_t>::epsilon(),
115 const scalar_t = 0.f)
const {
116 return (bounds[e_lower_z] - tol <= loc_p[1] &&
117 loc_p[1] <= bounds[e_upper_z] + tol);
126 template <concepts::scalar scalar_t>
127 DETRAY_HOST_DEVICE
constexpr scalar_t
measure(
137 template <concepts::scalar scalar_t>
138 DETRAY_HOST_DEVICE
constexpr scalar_t
area(
141 (bounds[e_upper_z] - bounds[e_lower_z]);
150 template <concepts::scalar scalar_t>
156 new_bounds[e_r] = math::max(bounds[e_r], o_bounds[e_r]);
157 new_bounds[e_lower_z] = math::min(bounds[e_lower_z], o_bounds[e_lower_z]);
158 new_bounds[e_upper_z] = math::max(bounds[e_upper_z], o_bounds[e_upper_z]);
172 template <concepts::algebra algebra_t>
179 return {-xy_bound, -xy_bound, bounds[e_lower_z] - env,
180 xy_bound, xy_bound, bounds[e_upper_z] + env};
185 template <concepts::algebra algebra_t>
190 0.5f * (bounds[e_lower_z] + bounds[e_upper_z])};
200 template <concepts::algebra algebra_t>
204 throw std::runtime_error(
205 "Vertex generation for cylinders is not implemented");
215 template <concepts::scalar scalar_t>
218 constexpr auto tol{10.f * std::numeric_limits<scalar_t>::epsilon()};
220 if (bounds[e_r] < tol) {
221 os <<
"DETRAY ERROR (HOST): Radius must be in the range (0, "
226 if (bounds[e_lower_z] >= bounds[e_upper_z] ||
227 math::fabs(bounds[e_lower_z] - bounds[e_upper_z]) < tol) {
228 os <<
"DETRAY ERROR (HOST): Neg. half length must be smaller than "
Geometrical shape of a 2D concentric cylinder.
Definition concentric_cylinder2D.hpp:32
constexpr scalar_t area(const bounds_type< scalar_t > &bounds) const
The area of a the shape.
Definition concentric_cylinder2D.hpp:138
dpoint3D< algebra_t > centroid(const bounds_type< dscalar< algebra_t > > &bounds) const
Definition concentric_cylinder2D.hpp:186
constexpr bounds_type< scalar_t > merge(const bounds_type< scalar_t > &bounds, const bounds_type< scalar_t > &o_bounds) const
Merge two concentric cylinder shapes.
Definition concentric_cylinder2D.hpp:151
darray< scalar_t, boundaries::e_size > bounds_type
Container definition for the shape boundary values.
Definition concentric_cylinder2D.hpp:47
static constexpr std::size_t dim
Dimension of the local coordinate system.
Definition concentric_cylinder2D.hpp:58
boundaries
Indices describing the entries in the shape boundary array.
Definition concentric_cylinder2D.hpp:38
constexpr bool check_consistency(const bounds_type< scalar_t > &bounds, std::ostream &os) const
Check consistency of boundary values.
Definition concentric_cylinder2D.hpp:216
bool_t result_type
Result type of a boundary check.
Definition concentric_cylinder2D.hpp:55
darray< dscalar< algebra_t >, 6 > local_min_bounds(const bounds_type< dscalar< algebra_t > > &bounds, const dscalar< algebra_t > env=std::numeric_limits< dscalar< algebra_t > >::epsilon()) const
Lower and upper point for minimal axis aligned bounding box.
Definition concentric_cylinder2D.hpp:173
concentric_cylindrical2D< algebra_t > local_frame_type
Local coordinate frame for boundary checks.
Definition concentric_cylinder2D.hpp:51
constexpr result_type< dbool< algebra_t > > check_boundaries(const bounds_type< dscalar< algebra_t > > &bounds, const dtransform3D< algebra_t > &, const dpoint3D< algebra_t > &glob_p, const dscalar< algebra_t > tol=std::numeric_limits< dscalar< algebra_t > >::epsilon(), const dscalar< algebra_t >=0.f) const
Check boundary values for a local point.
Definition concentric_cylinder2D.hpp:84
dvector< dpoint3D< algebra_t > > vertices(const bounds_type< dscalar< algebra_t > > &, dindex) const
Generate vertices in local cartesian frame.
Definition concentric_cylinder2D.hpp:201
scalar_t min_dist_to_boundary(const bounds_type< scalar_t > &bounds, const point_t &loc_p) const
Find the minimum distance to any boundary.
Definition concentric_cylinder2D.hpp:70
static constexpr std::string_view name
The name for this shape.
Definition concentric_cylinder2D.hpp:35
constexpr scalar_t measure(const bounds_type< scalar_t > &bounds) const
Measure of the shape: Area.
Definition concentric_cylinder2D.hpp:127
constexpr auto check_boundaries(const bounds_type< scalar_t > &bounds, const point_t &loc_p, const scalar_t tol=std::numeric_limits< scalar_t >::epsilon(), const scalar_t=0.f) const
Definition concentric_cylinder2D.hpp:112
Detray include(s).
Definition array_operators.hpp:18
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
vecmem::vector< value_t > dvector
Vector container backed by vecmem.
Definition containers.hpp:34
unsigned int dindex
Default index type.
Definition indexing.hpp:18
std::array< value_t, kDIM > darray
Fixed-size array container.
Definition containers.hpp:30
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72
get_point2D_t< A, T > dpoint2D
Two-dimensional point type for algebra A and value type T.
Definition algebra.hpp:68
Projection into a 2D concentric cylindrical frame (No rotation in coordinate transformation).
Definition concentric_cylindrical2D.hpp:21
static constexpr scalar_t pi
π
Definition units.hpp:136