Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::lit::Angle Struct Reference

Wrapper and helper to abstract conversions between degree and radian angles. More...

#include <OxygenEngine/util/angle.h>

Public Member Functions

constexpr Angle () noexcept=default
 Default constructor to create a "0" angle.
 
constexpr Angle (const float angle) noexcept
 Create an Angle from a value.
 
constexpr void setDegrees (const float angle) noexcept
 Set angle value in degrees.
 
constexpr void setRadians (const float angle) noexcept
 Set angle value in radians.
 
constexpr float getDegrees () const noexcept
 Get angle value in degrees.
 
constexpr float getRadians () const noexcept
 Get angle value in radians.
 
constexpr Angle operator- () const noexcept
 Apply negation on an angle.
 

Static Public Member Functions

static constexpr Angle fromDegrees (const float angle) noexcept
 Create an angle from a value in degrees.
 
static constexpr Angle fromRadians (const float angle) noexcept
 Create an angle from a value in radians.
 

Public Attributes

float radians = 0.f
 Angle value in radians.
 

Detailed Description

Wrapper and helper to abstract conversions between degree and radian angles.

You can use litterals to create angles from numeric values:

oe::lit::Angle angle_45_degrees = 45_deg;
oe::lit::Angle angle_180_degrees = 3.141592_rad;
Wrapper and helper to abstract conversions between degree and radian angles.
Definition angle.h:19

Constructor & Destructor Documentation

◆ Angle()

constexpr oe::lit::Angle::Angle ( const float  angle)
inlineexplicitconstexprnoexcept

Create an Angle from a value.

Parameters
anglein radians

Member Function Documentation

◆ fromDegrees()

static constexpr Angle oe::lit::Angle::fromDegrees ( const float  angle)
inlinestaticconstexprnoexcept

Create an angle from a value in degrees.

Parameters
anglein degrees
Returns
Angle with value converted

◆ fromRadians()

static constexpr Angle oe::lit::Angle::fromRadians ( const float  angle)
inlinestaticconstexprnoexcept

Create an angle from a value in radians.

Parameters
anglein radians
Returns
Angle with value converted

◆ getDegrees()

constexpr float oe::lit::Angle::getDegrees ( ) const
inlineconstexprnoexcept

Get angle value in degrees.

Returns
angle in degrees

◆ getRadians()

constexpr float oe::lit::Angle::getRadians ( ) const
inlineconstexprnoexcept

Get angle value in radians.

Note
Mainly here for completeness with getDegrees()
Returns
angle in radians

◆ operator-()

constexpr Angle oe::lit::Angle::operator- ( ) const
inlineconstexprnoexcept

Apply negation on an angle.

Returns
Opposite angle

◆ setDegrees()

constexpr void oe::lit::Angle::setDegrees ( const float  angle)
inlineconstexprnoexcept

Set angle value in degrees.

Parameters
anglein degrees

◆ setRadians()

constexpr void oe::lit::Angle::setRadians ( const float  angle)
inlineconstexprnoexcept

Set angle value in radians.

Note
Mainly here for completeness with setDegrees()
Parameters
anglein radians

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