Blender V4.3
blender::math::AxisSigned Class Reference

#include <BLI_math_basis_types.hh>

Public Types

enum class  Value : int8_t {
  X_POS = 0 , Y_POS = 1 , Z_POS = 2 , X_NEG = 3 ,
  Y_NEG = 4 , Z_NEG = 5
}
 

Public Member Functions

 AxisSigned ()=default
 
constexpr AxisSigned (Value axis)
 
constexpr AxisSigned (Axis axis)
 
constexpr Axis axis () const
 
AxisSigned operator- () const
 
AxisSigned next_after () const
 
constexpr operator Value () const
 
constexpr int as_int () const
 
constexpr int sign () const
 
constexpr bool is_negative () const
 
 operator bool () const =delete
 

Static Public Member Functions

static constexpr AxisSigned from_int (int axis_int)
 

Static Public Attributes

static constexpr Value X_POS = Value::X_POS
 
static constexpr Value Y_POS = Value::Y_POS
 
static constexpr Value Z_POS = Value::Z_POS
 
static constexpr Value X_NEG = Value::X_NEG
 
static constexpr Value Y_NEG = Value::Y_NEG
 
static constexpr Value Z_NEG = Value::Z_NEG
 

Friends

std::ostream & operator<< (std::ostream &stream, const AxisSigned axis)
 

Detailed Description

An enum class representing one of the 6 axis aligned direction. This is implemented using a class to allow operators and methods. NOTE: While this represents a 3D axis it can still be used to generate 2D basis vectors.

Definition at line 101 of file BLI_math_basis_types.hh.

Member Enumeration Documentation

◆ Value

Enumerator
X_POS 
Y_POS 
Z_POS 
X_NEG 
Y_NEG 
Z_NEG 

Definition at line 103 of file BLI_math_basis_types.hh.

Constructor & Destructor Documentation

◆ AxisSigned() [1/3]

blender::math::AxisSigned::AxisSigned ( )
default

◆ AxisSigned() [2/3]

blender::math::AxisSigned::AxisSigned ( Value axis)
inlineconstexpr

Definition at line 127 of file BLI_math_basis_types.hh.

◆ AxisSigned() [3/3]

blender::math::AxisSigned::AxisSigned ( Axis axis)
inlineconstexpr

Definition at line 128 of file BLI_math_basis_types.hh.

Member Function Documentation

◆ as_int()

int blender::math::AxisSigned::as_int ( ) const
inlineconstexpr

◆ axis()

Axis blender::math::AxisSigned::axis ( ) const
inlineconstexpr

Return the axis without the sign. It changes the type whereas abs(axis) doesn't.

Definition at line 139 of file BLI_math_basis_types.hh.

References as_int(), and blender::math::Axis::from_int().

Referenced by from_int(), blender::math::from_tracking(), blender::math::from_vector(), blender::math::invert(), blender::math::tests::TEST(), and blender::math::transform_point().

◆ from_int()

static constexpr AxisSigned blender::math::AxisSigned::from_int ( int axis_int)
inlinestaticconstexpr

Allow casting from DNA enums stored as short / int.

Definition at line 131 of file BLI_math_basis_types.hh.

References axis(), BLI_assert, X_POS, and Z_NEG.

Referenced by next_after(), operator-(), blender::math::tests::TEST(), blender::math::tests::TEST(), and blender::math::to_vector().

◆ is_negative()

bool blender::math::AxisSigned::is_negative ( ) const
inlineconstexpr

Returns true if axis is negative, false otherwise.

Definition at line 174 of file BLI_math_basis_types.hh.

References int, and Z_POS.

Referenced by blender::math::from_vector(), blender::math::invert(), sign(), and blender::math::transform_point().

◆ next_after()

AxisSigned blender::math::AxisSigned::next_after ( ) const
inline

Return next enum value.

Definition at line 151 of file BLI_math_basis_types.hh.

References as_int(), and from_int().

Referenced by blender::math::rotation_between().

◆ operator bool()

blender::math::AxisSigned::operator bool ( ) const
explicitdelete

Avoid hell.

◆ operator Value()

blender::math::AxisSigned::operator Value ( ) const
inlineconstexpr

Allow usage in switch() statements and comparisons.

Definition at line 157 of file BLI_math_basis_types.hh.

◆ operator-()

AxisSigned blender::math::AxisSigned::operator- ( ) const
inline

Return the opposing axis.

Definition at line 145 of file BLI_math_basis_types.hh.

References as_int(), and from_int().

◆ sign()

int blender::math::AxisSigned::sign ( ) const
inlineconstexpr

Returns -1 if axis is negative, 1 otherwise.

Definition at line 168 of file BLI_math_basis_types.hh.

References is_negative().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const AxisSigned axis )
friend

Definition at line 25 of file math_basis_types.cc.

Member Data Documentation

◆ X_NEG

◆ X_POS

◆ Y_NEG

◆ Y_POS

◆ Z_NEG

◆ Z_POS


The documentation for this class was generated from the following file: