ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::ConvexPolygonBounds< N > Class Template Reference

This is the actual implementation of the bounds. More...

#include <Acts/Surfaces/ConvexPolygonBounds.hpp>

Inheritance diagram for Acts::ConvexPolygonBounds< N >:
[legend]
Collaboration diagram for Acts::ConvexPolygonBounds< N >:
[legend]

Public Member Functions

 ConvexPolygonBounds (std::span< const double > values) noexcept(false)
 Constructor from a fixed size array of parameters This will throw if the vertices do not form a convex polygon.
 ConvexPolygonBounds (std::span< const Vector2 > vertices) noexcept(false)
 Constructor from a vector of vertices, to facilitate construction.
Vector2 closestPoint (const Vector2 &lposition, const SquareMatrix2 &metric) const final
 Calculates the closest point on the bounds to a given local position.
bool inside (const Vector2 &lposition) const final
 Inside check for the bounds object.
virtual bool inside (const Vector2 &lposition, const BoundaryTolerance &boundaryTolerance) const
 Inside check for the bounds object given a boundary tolerance.
std::vector< Vector2vertices (unsigned int ignoredSegments=0u) const final
 Return the vertices.
Public Member Functions inherited from Acts::ConvexPolygonBoundsBase
const RectangleBoundsboundingBox () const final
 Return a rectangle bounds object that encloses this polygon.
Vector2 center () const final
 Calculate the center of the surface bounds in local coordinates.
std::ostream & toStream (std::ostream &sl) const final
 Output Method for std::ostream.
BoundsType type () const final
 Return the bounds type of this bounds object.
std::vector< double > values () const final
 Return the bound values as dynamically sized vector.
Public Member Functions inherited from Acts::PlanarBounds
SquareMatrix2 boundToCartesianJacobian (const Vector2 &lposition) const final
 Computes the bound to cartesian jacobian at a given local position.
SquareMatrix2 boundToCartesianMetric (const Vector2 &lposition) const final
 Computes the bound to cartesian metric at a given local position.
bool isCartesian () const final
 Check if the bound coordinates are cartesian.
Public Member Functions inherited from Acts::SurfaceBounds
virtual ~SurfaceBounds ()=default
virtual double distance (const Vector2 &lposition) const
 Calculates the distance to the bounds from a given local position.

Static Public Attributes

static constexpr std::size_t eSize = 2 * N
 Expose number of parameters as a template parameter.
static constexpr std::size_t nVertices = N
 Expose number of vertices given as template parameter.

Additional Inherited Members

Public Types inherited from Acts::SurfaceBounds
enum  BoundsType : int {
  eCone = 0 , eCylinder = 1 , eDiamond = 2 , eDisc = 3 ,
  eEllipse = 4 , eLine = 5 , eRectangle = 6 , eTrapezoid = 7 ,
  eTriangle = 8 , eDiscTrapezoid = 9 , eConvexPolygon = 10 , eAnnulus = 11 ,
  eBoundless = 12 , eOther = 13
}
 This is nested to the SurfaceBounds, as also VolumeBounds will have Bounds Type. More...
Protected Member Functions inherited from Acts::ConvexPolygonBoundsBase
void calculateCenter (std::span< const Vector2 > vertices)
 Calculate and cache the center point from vertices.
void makeBoundingBox (std::span< const Vector2 > vertices)
 Creates a rectangle bounds instance that encloses a set of vertices.
Static Protected Member Functions inherited from Acts::ConvexPolygonBoundsBase
static void checkConsistency (std::span< const Vector2 > vertices) noexcept(false)
 Return whether this bounds class is in fact convex thorws a logic error if not.
template<typename coll_t>
requires std::same_as<typename coll_t::value_type, Acts::Vector2>
static void convex_impl (const coll_t &vertices) noexcept(false)
 Calculates whether a set of vertices forms a convex polygon.

Detailed Description

template<int N>
requires isValidConvexPolygonSize<N>
class Acts::ConvexPolygonBounds< N >

This is the actual implementation of the bounds.

It is templated on the number of vertices, but there is a specialization for dynamic number of vertices, where the underlying storage is then a vector.

Template Parameters
NNumber of vertices

Constructor & Destructor Documentation

◆ ConvexPolygonBounds() [1/2]

template<int N>
Acts::ConvexPolygonBounds< N >::ConvexPolygonBounds ( std::span< const Vector2 > vertices)
explicitnoexcept

Constructor from a vector of vertices, to facilitate construction.

This will throw if the vector size does not match num_vertices. This will throw if the vertices do not form a convex polygon.

Parameters
verticesThe list of vertices.

◆ ConvexPolygonBounds() [2/2]

template<int N>
Acts::ConvexPolygonBounds< N >::ConvexPolygonBounds ( std::span< const double > values)
explicit

Constructor from a fixed size array of parameters This will throw if the vertices do not form a convex polygon.

Parameters
valuesThe values to build up the vertices

Member Function Documentation

◆ closestPoint()

template<int N>
Vector2 Acts::ConvexPolygonBounds< N >::closestPoint ( const Vector2 & lposition,
const SquareMatrix2 & metric ) const
finalvirtual

Calculates the closest point on the bounds to a given local position.

Parameters
lpositionis the local position
metricto be used for the distance calculation
Returns
the closest point on the bounds

Implements Acts::SurfaceBounds.

◆ inside() [1/2]

template<int N>
bool Acts::ConvexPolygonBounds< N >::inside ( const Vector2 & lposition) const
finalvirtual

Inside check for the bounds object.

Parameters
lpositionis the local position
Returns
true if the local position is inside the bounds

Implements Acts::SurfaceBounds.

◆ inside() [2/2]

template<int N>
virtual bool Acts::SurfaceBounds::inside ( const Vector2 & lposition,
const BoundaryTolerance & boundaryTolerance ) const
virtual

Inside check for the bounds object given a boundary tolerance.

Parameters
lpositionis the local position
boundaryToleranceis the boundary tolerance object
Returns
true if the local position is inside the bounds and tolerance

Reimplemented from Acts::SurfaceBounds.

◆ vertices()

template<int N>
std::vector< Vector2 > Acts::ConvexPolygonBounds< N >::vertices ( unsigned int ignoredSegments = 0u) const
finalvirtual

Return the vertices.

Parameters
ignoredSegmentsthe number of segments used to approximate and eventually curved line
Note
the number of segments is ignored in this representation
Returns
vector for vertices in 2D

Implements Acts::PlanarBounds.

Member Data Documentation

◆ eSize

template<int N>
std::size_t Acts::ConvexPolygonBounds< N >::eSize = 2 * N
staticconstexpr

Expose number of parameters as a template parameter.

Note
The eSize name here emulates the size of the bound values in other bounds classes.

◆ nVertices

template<int N>
std::size_t Acts::ConvexPolygonBounds< N >::nVertices = N
staticconstexpr

Expose number of vertices given as template parameter.