File RangeXD.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

template<std::size_t Dims, typename Type, template<typename, std::size_t> typename Vector = std::array>
class RangeXD
#include <Acts/Utilities/RangeXD.hpp>

An orthogonal range in an arbitrary number of dimensions.

By combining a number one-dimensional ranges we can (under the assumption that our axes are orthogonal) construct an orthogonal range of values. In other words, a hyperrectangular volume in space.

Template Parameters
  • Dims – The number of dimensions in our range

  • Type – The scalar type of our ranges

  • Vector – The vector type used to define coordinates

Public Types

using coordinate_t = Vector<Type, Dims>

The type used to describe coordinates in our range.

Public Functions

inline bool contains(const coordinate_t &v) const

Determine whether the range contains a certain point.

This is true if and only if the range contains the point in all of its dimensions.

Parameters

v – The coordinate to check for membership in the range

Returns

true The coordinate is inside the range

Returns

false The coordinate is outside the range

inline bool degenerate(void) const

Determine whether this range is degenerate.

A degenerate multi-dimensional range has no volume and cannot contain any values. This is the case if any of its dimensions are degenerate.

Returns

true The range is degenerate

Returns

false The range is not degenerate

inline RangeXD<Dims, Type, Vector> operator&(const RangeXD<Dims, Type, Vector> &o) const

Compute the intersection of this range with another range.

The intersection of one orthogonal range with another orthogonal range is in itself an orthogonal range. This operation is commutative. This intersection between two n-dimensional ranges is defined simply as the intersection in each dimension of the two ranges.

Parameters

o – The orthogonal range to compute the intersection with

Returns

The intersection between the ranges

inline bool operator&&(const RangeXD<Dims, Type, Vector> &r) const

Determine whether this range intersects another.

Two n-dimensional ranges intersect if and only if they intersect in every one of their n dimensions. Otherwise, they are disjoint.

Parameters

r – The other range to check

Returns

true The ranges intersect

Returns

false The ranges do not intersect

inline RangeXD<Dims, Type, Vector> &operator&=(const RangeXD<Dims, Type, Vector> &o)

Update the range to the intersection with another range.

This is the assignment version of the operator& method, meaning that it updates the object on which it is called rather than producing a new range.

Parameters

o – The range to compute the intersection with

Returns

This object

inline bool operator<=(const RangeXD<Dims, Type, Vector> &o) const

Determine whether one range is a subset of another range.

One range is a subset of another range if and only if all points contained within the first set are also contained within the second set. Alternatively, this is equivalent to each of the first range’s one-dimensional ranges being a subset of the second range’s equivalent one-dimensional range.

Parameters

o – The other range to compare to

Returns

true The first range is a subset of the second range

Returns

false The first range is not a subset of the second range

inline bool operator==(const RangeXD<Dims, Type, Vector> &o) const

Determine whether two ranges are equal.

Two n-dimensional ranges are equal if and only if they are equal in each of their n dimensions.

Parameters

o – The other range to check for equality

Returns

true The ranges are equal

Returns

false The ranges are not equal

inline bool operator>=(const RangeXD<Dims, Type, Vector> &o) const

Determine whether one range is a superset of another range.

One range is a superset of another range if and only if all points contained within the second range are also contained within the first range. Alternatively, this is equivalent to each of the one-dimensional ranges in the first range being a superset of the corresponding one-dimensional range in the second range.

Parameters

o – The other range to compare to

Returns

true The left-hand range is a superset of the right-hand range

Returns

false The left-hand range is not a superset of the right-hand range

inline Range1D<Type> &operator[](const std::size_t &i)

Access one of the dimensional ranges of the volume.

Parameters

i – The index of the dimension to access

Returns

A reference to the dimension contained in this range

inline const Range1D<Type> &operator[](const std::size_t &i) const

Access one of the dimensional ranges of the volume.

Parameters

i – The index of the dimension to access

Returns

A reference to the dimension contained in this range

inline std::string toString(void) const

Represent the range as a string.

This method produces a helpful string that can be used to debug the range if needed. Not really designed to be used in production code.

Returns

A string representing the range

Private Members

std::array<Range1D<Type>, Dims> m_dims