Class Acts::Direction

class Direction

The direction is always with respect to a given momentum, surface normal or other general axes.

Public Functions

inline constexpr Direction() = default
inline constexpr Direction(Value value)
inline constexpr std::size_t index() const

Convert dir to index [0,1] which allows to store direction dependent objects in std::array<T, 2u>

Returns

either 0 or 1

inline constexpr Direction invert() const

Reverse the direction.

Parameters

dir – is the direction at input

Returns

an opposite direction

inline constexpr bool operator!=(Direction other) const
inline constexpr bool operator==(Direction other) const
inline constexpr int sign() const

Turns the direction into a signed value.

Returns

a signed value

std::string toString() const

Public Static Functions

static inline constexpr Direction fromIndex(std::size_t index)

Convert and index [0,1] to a direction e.g.

for sorting in std::array<T, 2u>

Parameters

index – is the direction at input

static inline constexpr Direction fromScalar(ActsScalar scalar)

This turns a signed value into a direction.

Will assert on zero.

Parameters

scalar – is the signed value

Returns

a direciton enum

static inline constexpr Direction fromScalarZeroAsPositive(ActsScalar scalar)

This turns a signed value into a direction and 0 will be handled as a positive direction.

Only use this when you are convinced that the 0 case is properly handled downstream.

Parameters

scalar – is the signed value

Returns

a direciton enum

Public Static Attributes

static constexpr auto Backward = Value::Negative
static constexpr auto Forward = Value::Positive
static constexpr auto Negative = Value::Negative
static constexpr auto Positive = Value::Positive