ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::Frustum< value_t, DIM, SIDES > Class Template Reference

Class representing a frustum shape. More...

#include <Acts/Utilities/Frustum.hpp>

Public Types

using transform_type = Eigen::Transform<value_t, DIM, Eigen::Affine>
 Associated transform type.
using value_type = value_t
 Re expose the value type.
using vertex_array_type = Eigen::Array<value_t, DIM, 1>
 Vertex array type corresponding to the vertex type.
using VertexType = Eigen::Matrix<value_t, DIM, 1>
 Vertex type based on the value type and dimension.

Public Member Functions

 Frustum (const VertexType &origin, const VertexType &dir, value_type opening_angle)
 Constructor for the 3D case.
 Frustum (const VertexType &origin, const VertexType &dir, value_type opening_angle)
 Constructor for the 2D case.
const VertexTypedir () const
 Getter for the direction of the frustum.
void draw (IVisualization3D &helper, value_type far_distance=10) const
 Draw a representation of this frustum using a visualization helper.
const std::array< VertexType, SIDES+1 > & normals () const
 Getter for the normal vectors of the planes defining this frustum.
const VertexTypeorigin () const
 Getter for the oriogin of the frustum.
std::ostream & svg (std::ostream &os, value_type w, value_type h, value_type far_distance=1, value_type unit=20.) const
 Draw a representation of this frustum as an SVG string to an outstream.
Frustum< value_t, DIM, SIDES > transformed (const transform_type &trf) const
 Transforms this frustum using a given transform and returns a new instance.

Static Public Attributes

static constexpr std::size_t dim = DIM
 Re expose the number of dimensions.
static constexpr std::size_t sides = SIDES
 Re expose the number of sides.

Detailed Description

template<typename value_t, std::size_t DIM, std::size_t SIDES>
class Acts::Frustum< value_t, DIM, SIDES >

Class representing a frustum shape.

The frustum is defined using an origin, a direction and an opening angle. These parameters are then used to calculate a number of side planes, each having a position and a normal vector. The "near plane" is assumed to coincide with the origin point, and the normal with the "direction" of the frustum. No far plane is defined.

Template Parameters
value_tThe floating point value to use
DIMThe number of dimensions of ambient space
SIDESThe number of sides (= side planes) the frustum has (exactly 2 in 2D, minimum 3 in 3D)

Member Typedef Documentation

◆ transform_type

template<typename value_t, std::size_t DIM, std::size_t SIDES>
using Acts::Frustum< value_t, DIM, SIDES >::transform_type = Eigen::Transform<value_t, DIM, Eigen::Affine>

Associated transform type.

◆ value_type

template<typename value_t, std::size_t DIM, std::size_t SIDES>
using Acts::Frustum< value_t, DIM, SIDES >::value_type = value_t

Re expose the value type.

◆ vertex_array_type

template<typename value_t, std::size_t DIM, std::size_t SIDES>
using Acts::Frustum< value_t, DIM, SIDES >::vertex_array_type = Eigen::Array<value_t, DIM, 1>

Vertex array type corresponding to the vertex type.

◆ VertexType

template<typename value_t, std::size_t DIM, std::size_t SIDES>
using Acts::Frustum< value_t, DIM, SIDES >::VertexType = Eigen::Matrix<value_t, DIM, 1>

Vertex type based on the value type and dimension.

Constructor & Destructor Documentation

◆ Frustum() [1/2]

template<typename value_t, std::size_t DIM, std::size_t SIDES>
Acts::Frustum< value_t, DIM, SIDES >::Frustum ( const VertexType & origin,
const VertexType & dir,
value_type opening_angle )

Constructor for the 2D case.

Parameters
originThe origin of the frustum
dirThe direction of the frustum
opening_angleThe opening angle
Note
The opening_angle is defined as the angle between opposing side planes. The opening angle needs to be < pi.

◆ Frustum() [2/2]

template<typename value_t, std::size_t DIM, std::size_t SIDES>
Acts::Frustum< value_t, DIM, SIDES >::Frustum ( const VertexType & origin,
const VertexType & dir,
value_type opening_angle )

Constructor for the 3D case.

Parameters
originThe origin of the frustum
dirThe direction of the frustum
opening_angleThe opening angle
Note
The opening_angle is defined as the angle between opposing side planes. The opening angle needs to be < pi.

Member Function Documentation

◆ dir()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
const VertexType & Acts::Frustum< value_t, DIM, SIDES >::dir ( ) const

Getter for the direction of the frustum.

Returns
The direction of the frustum

◆ draw()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
void Acts::Frustum< value_t, DIM, SIDES >::draw ( IVisualization3D & helper,
value_type far_distance = 10 ) const

Draw a representation of this frustum using a visualization helper.

Note
This is only available for the 3D case.
Parameters
helperThe visualization helper
far_distanceThe distance to the virtual "far plane" at which point the side planes terminate visually.

◆ normals()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
const std::array< VertexType, SIDES+1 > & Acts::Frustum< value_t, DIM, SIDES >::normals ( ) const

Getter for the normal vectors of the planes defining this frustum.

Returns
Array containing the normal vectors for all planes.
Note
The size of the array that is returned is fixed to number of sides + 1

◆ origin()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
const VertexType & Acts::Frustum< value_t, DIM, SIDES >::origin ( ) const

Getter for the oriogin of the frustum.

Returns
The origin of the frustum

◆ svg()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
std::ostream & Acts::Frustum< value_t, DIM, SIDES >::svg ( std::ostream & os,
value_type w,
value_type h,
value_type far_distance = 1,
value_type unit = 20. ) const

Draw a representation of this frustum as an SVG string to an outstream.

Note
This is only available for the 2D case.
Parameters
osThe out stream to write to
wThe width of the output SVG
hThe height of the output SVG
far_distanceThe distance to the virtual "far line" at which point the side lines terminate visually.
unitMultiplicative factor to apply to internal distances
Returns
Reference to the output stream for method chaining

◆ transformed()

template<typename value_t, std::size_t DIM, std::size_t SIDES>
Frustum< value_t, DIM, SIDES > Acts::Frustum< value_t, DIM, SIDES >::transformed ( const transform_type & trf) const

Transforms this frustum using a given transform and returns a new instance.

Parameters
trfThe transform to apply
Returns
A copy of this frustum with the transform trf applied.

Member Data Documentation

◆ dim

template<typename value_t, std::size_t DIM, std::size_t SIDES>
std::size_t Acts::Frustum< value_t, DIM, SIDES >::dim = DIM
staticconstexpr

Re expose the number of dimensions.

◆ sides

template<typename value_t, std::size_t DIM, std::size_t SIDES>
std::size_t Acts::Frustum< value_t, DIM, SIDES >::sides = SIDES
staticconstexpr

Re expose the number of sides.