File Direction.hpp

namespace Acts


This file is foreseen for the Geometry module to replace Extent


inline Acts::Vector3 operator*(const Acts::Vector3 &value, Direction dir)
inline Acts::Vector3 operator*(Direction dir, const Acts::Vector3 &value)
inline constexpr double operator*(Direction dir, double value)
inline constexpr float operator*(Direction dir, float value)
inline constexpr int operator*(Direction dir, int value)
inline constexpr double operator*(double value, Direction dir)
inline constexpr float operator*(float value, Direction dir)
inline constexpr int operator*(int value, Direction dir)
inline Acts::Vector3 &operator*=(Acts::Vector3 &value, Direction dir)
inline constexpr double operator*=(double &value, Direction dir)
inline constexpr float operator*=(float &value, Direction dir)
inline constexpr int operator*=(int &value, Direction dir)
std::ostream &operator<<(std::ostream &os, Direction dir)
class Direction
#include <Acts/Definitions/Direction.hpp>

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>


either 0 or 1

inline constexpr Direction invert() const

Reverse the direction.


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.


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>


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.


scalar – is the signed value


a direction 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.


scalar – is the signed value


a direction 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

Private Types

enum class Value : int


enumerator Negative
enumerator Positive

Private Members

Value m_value = Value::Positive