File ConvexPolygonBounds.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Variables

constexpr int PolygonDynamic = -1

Tag to trigger specialization of a dynamic polygon.

template<int N>
class ConvexPolygonBounds : public Acts::ConvexPolygonBoundsBase
#include <Acts/Surfaces/ConvexPolygonBounds.hpp>

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

N – Number of vertices

Public Types

using value_array = std::array<double, eSize>

Type that’s used to store the vertices, in this case a fixed size array.

using vertex_array = std::array<Vector2, num_vertices>

Type that’s used to store the vertices, in this case a fixed size array.

Public Functions

ConvexPolygonBounds() = delete
ConvexPolygonBounds(const std::vector<Vector2> &vertices) noexcept(false)

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

vertices – The list of vertices.

ConvexPolygonBounds(const value_array &values) noexcept(false)

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

Parameters

values – The values to build up the vertices

ConvexPolygonBounds(const vertex_array &vertices) noexcept(false)

Constructor from a fixed size array of vertices.

This will throw if the vertices do not form a convex polygon.

Parameters

vertices – The vertices

~ConvexPolygonBounds() override = default
virtual const RectangleBounds &boundingBox() const final

Return a rectangle bounds object that encloses this polygon.

Returns

The rectangular bounds

virtual bool inside(const Vector2 &lposition, const BoundaryCheck &bcheck) const final

Return whether a local 2D point lies inside of the bounds defined by this object.

Parameters
  • lposition – The local position to check

  • bcheck – The BoundaryCheck object handling tolerances.

Returns

Whether the points is inside

virtual BoundsType type() const final

Return the bounds type - for persistency optimization.

Returns

is a BoundsType enum

virtual std::vector<Vector2> vertices(unsigned int lseg = 1) const final

Return the vertices.

Note

the number of segments is ignored in this representation

Parameters

lseg – the number of segments used to approximate and eventually curved line

Returns

vector for vertices in 2D

Public Static Attributes

static constexpr size_t eSize = 2 * N

Expose number of parameters as a template parameter.

static constexpr size_t num_vertices = N

Expose number of vertices given as template parameter.

Private Functions

void checkConsistency() const noexcept(false)

Return whether this bounds class is in fact convex throws a log error if not.

Private Members

RectangleBounds m_boundingBox
vertex_array m_vertices
template<>
class ConvexPolygonBounds<PolygonDynamic> : public Acts::ConvexPolygonBoundsBase
#include <Acts/Surfaces/ConvexPolygonBounds.hpp>

This is the specialization handling a polygon with a dynamic number of points.

It can accept any number of points.

Public Functions

ConvexPolygonBounds() = delete

Default constructor, deleted.

ConvexPolygonBounds(const std::vector<Vector2> &vertices)

Constructor from a vector of vertices, to facilitate construction.

This will throw if the vertices do not form a convex polygon.

Parameters

vertices – The list of vertices.

~ConvexPolygonBounds() override = default

Defaulted destructor.

virtual const RectangleBounds &boundingBox() const final

Return a rectangle bounds object that encloses this polygon.

Returns

The rectangular bounds

virtual bool inside(const Vector2 &lposition, const BoundaryCheck &bcheck) const final

Return whether a local 2D point lies inside of the bounds defined by this object.

Parameters
  • lposition – The local position to check

  • bcheck – The BoundaryCheck object handling tolerances.

Returns

Whether the points is inside

virtual BoundsType type() const final

Return the bounds type of this bounds object.

Returns

The bounds type

virtual std::vector<Vector2> vertices(unsigned int lseg = 1) const final

Return the vertices.

Note

the number of segments is ignored in this representation

Parameters

lseg – the number of segments used to approximate and eventually curved line

Returns

vector for vertices in 2D

Public Static Attributes

static constexpr int eSize = -1

Private Functions

void checkConsistency() const noexcept(false)

Return whether this bounds class is in fact convex thorws a logic error if not.

Private Members

RectangleBounds m_boundingBox
boost::container::small_vector<Vector2, 10> m_vertices
class ConvexPolygonBoundsBase : public Acts::PlanarBounds
#include <Acts/Surfaces/ConvexPolygonBounds.hpp>

base class for convex polygon bounds

This class serves as a base class for the actual bounds class. The only deriving type is the templated ConvexPolygonBounds.

Subclassed by Acts::ConvexPolygonBounds< N >, Acts::ConvexPolygonBounds< PolygonDynamic >

Public Functions

virtual std::ostream &toStream(std::ostream &sl) const final

Output Method for std::ostream.

Parameters

sl – is the ostream to be written into

virtual std::vector<double> values() const final

Return the bound values as dynamically sized vector.

Returns

this returns a copy of the internal values

Protected Static Functions

template<typename coll_t>
static void convex_impl(const coll_t &vertices) noexcept(false)

Calculates whether a set of vertices forms a convex polygon.

This is generic over the number of vertices, so it’s factored out of the concrete classes and into this base class.

Parameters

vertices – A collection of vertices. throws a logic error if this is not the case

template<typename coll_t>
static RectangleBounds makeBoundingBox(const coll_t &vertices)

Return a rectangle bounds instance that encloses a set of vertices.

Parameters

vertices – A collection of vertices to enclose.

Returns

Enclosing rectangle.