ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::cylinder2D Class Reference

Geometrical shape of a 2D cylinder. More...

#include <detray/geometry/shapes/cylinder2D.hpp>

Collaboration diagram for detray::cylinder2D:
[legend]

Public Types

enum  boundaries : unsigned int { e_r = 0u , e_lower_z = 1u , e_upper_z = 2u , e_size = 3u }
 Indices describing the entries in the shape boundary array.
template<concepts::scalar scalar_t>
using bounds_type = darray<scalar_t, boundaries::e_size>
 Container definition for the shape boundary values.
template<concepts::algebra algebra_t>
using local_frame_type = cylindrical2D<algebra_t>
 Local coordinate frame for boundary checks.
template<typename bool_t>
using result_type = detail::boundary_check_result<bool_t>
 Result type of a boundary check.

Public Member Functions

template<concepts::scalar scalar_t>
constexpr scalar_t area (const bounds_type< scalar_t > &bounds) const
 The area of a the shape.
template<concepts::algebra algebra_t>
dpoint3D< algebra_t > centroid (const bounds_type< dscalar< algebra_t > > &bounds) const
template<concepts::scalar scalar_t>
constexpr bool check_consistency (const bounds_type< scalar_t > &bounds, std::ostream &os) const
 Check consistency of boundary values.
template<concepts::algebra algebra_t>
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.
template<concepts::scalar scalar_t>
constexpr scalar_t measure (const bounds_type< scalar_t > &bounds) const
 Measure of the shape: Area.
template<concepts::scalar scalar_t>
constexpr bounds_type< scalar_t > merge (const bounds_type< scalar_t > &bounds, const bounds_type< scalar_t > &o_bounds) const
 Merge two 2D cylinder shapes.
template<concepts::scalar scalar_t, concepts::point point_t>
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.
template<concepts::algebra algebra_t>
dvector< dpoint3D< algebra_t > > vertices (const bounds_type< dscalar< algebra_t > > &, dindex) const
 Generate vertices in local cartesian frame.
template<concepts::algebra algebra_t>
constexpr result_type< dbool< algebra_t > > check_boundaries (const bounds_type< dscalar< algebra_t > > &bounds, const dtransform3D< algebra_t > &trf, const dpoint3D< algebra_t > &glob_p, const dscalar< algebra_t > tol=std::numeric_limits< dscalar< algebra_t > >::epsilon(), const dscalar< algebra_t > edge_tol=0.f) const
 Check boundary values for a local point.
template<concepts::scalar scalar_t, concepts::point point_t>
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 edge_tol=0.f) const

Static Public Attributes

static constexpr std::size_t dim {2u}
 Dimension of the local coordinate system.
static constexpr std::string_view name = "cylinder2D"
 The name for this shape.

Detailed Description

Geometrical shape of a 2D cylinder.

It is defined by r and the two half lengths rel to the coordinate center.

Member Function Documentation

◆ area()

template<concepts::scalar scalar_t>
scalar_t detray::cylinder2D::area ( const bounds_type< scalar_t > & bounds) const
constexpr

The area of a the shape.

Parameters
boundsthe boundary values for this shape
Returns
the stereo annulus area.

◆ centroid()

template<concepts::algebra algebra_t>
dpoint3D< algebra_t > detray::cylinder2D::centroid ( const bounds_type< dscalar< algebra_t > > & bounds) const
Parameters
boundsBoundary values used to determine the center.
Returns
the shapes centroid in local cartesian coordinates

◆ check_boundaries() [1/2]

template<concepts::algebra algebra_t>
result_type< dbool< algebra_t > > detray::cylinder2D::check_boundaries ( const bounds_type< dscalar< algebra_t > > & bounds,
const dtransform3D< algebra_t > & trf,
const dpoint3D< algebra_t > & glob_p,
const dscalar< algebra_t > tol = std::numeric_limits<dscalar<algebra_t>>::epsilon(),
const dscalar< algebra_t > edge_tol = 0.f ) const
constexpr

Check boundary values for a local point.

Parameters
boundsthe boundary values for this shape
trfthe surface transform
glob_pthe point to be checked in the global coordinate system
toldynamic tolerance determined by caller
edge_tolAdditional tolerance used to classify points near an edge.
Returns
true if the local point lies within the given boundaries.

◆ check_boundaries() [2/2]

template<concepts::scalar scalar_t, concepts::point point_t>
auto detray::cylinder2D::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 edge_tol = 0.f ) const
constexpr
Note
the point is expected to be given in local coordinates by the caller. For the conversion from global cartesian coordinates, the nested shape struct can be used. The point is assumed to be in the cylinder 2D frame (r * phi, z).
Template Parameters
is_rad_checkwhether the radial bound should be checked in this call.
Parameters
boundsthe boundary values for this shape
loc_pthe point to be checked in the local coordinate system
toldynamic tolerance determined by caller
edge_tolAdditional tolerance used to classify points near an edge.
Returns
true if the local point lies within the given boundaries.

◆ check_consistency()

template<concepts::scalar scalar_t>
bool detray::cylinder2D::check_consistency ( const bounds_type< scalar_t > & bounds,
std::ostream & os ) const
constexpr

Check consistency of boundary values.

Parameters
boundsthe boundary values for this shape
osoutput stream for error messages
Returns
true if the bounds are consistent.

◆ local_min_bounds()

template<concepts::algebra algebra_t>
darray< dscalar< algebra_t >, 6 > detray::cylinder2D::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.

Computes the min and max vertices in a local cartesian frame.

Parameters
boundsthe boundary values for this shape
envdynamic envelope around the shape
Returns
an array of coordinates that contains the lower point (first three values) and the upper point (latter three values) .

◆ measure()

template<concepts::scalar scalar_t>
scalar_t detray::cylinder2D::measure ( const bounds_type< scalar_t > & bounds) const
constexpr

Measure of the shape: Area.

Parameters
boundsthe boundary values for this shape
Returns
the cylinder area on the cylinder of radius r.

◆ merge()

template<concepts::scalar scalar_t>
bounds_type< scalar_t > detray::cylinder2D::merge ( const bounds_type< scalar_t > & bounds,
const bounds_type< scalar_t > & o_bounds ) const
constexpr

Merge two 2D cylinder shapes.

Parameters
boundsthe boundary values for this shape
o_boundsthe boundary values for the other shape
Returns
merged bound values

◆ min_dist_to_boundary()

template<concepts::scalar scalar_t, concepts::point point_t>
scalar_t detray::cylinder2D::min_dist_to_boundary ( const bounds_type< scalar_t > & bounds,
const point_t & loc_p ) const

Find the minimum distance to any boundary.

Note
the point is expected to be given in local coordinates by the caller.
Parameters
boundsthe boundary values for this shape
loc_pthe point to be checked in the local coordinate system
Returns
the minimum distance.

◆ vertices()

template<concepts::algebra algebra_t>
dvector< dpoint3D< algebra_t > > detray::cylinder2D::vertices ( const bounds_type< dscalar< algebra_t > > & ,
dindex  ) const

Generate vertices in local cartesian frame.

Boundary values define the vertices in the local frame. The optional segment count controls tessellation of the curved boundary.

Returns
a generated list of vertices