Template Class angle

Class Documentation

template<data_precision p = data_precision::bit32>
class legion::core::math::angle

Represents an angle does the rad/deg conversion internally so that the user does not have to worry about it.

Template Parameters
  • p: The data_precision of the angle class (typically bit32).

Public Types

using storage_type = precision_chooser_t<p>

Public Functions

angle(const angle &other) = default
angle(angle &&other) noexcept = default
angle &operator=(const angle &other) = default
angle &operator=(angle &&other) noexcept = default
~angle() = default
constexpr storage_type as_degrees() const

Converts an angle to degrees.

constexpr storage_type as_radians() const

Converts an angle to radians.

storage_type sin()

Applies the trigonometric sinus function on the angle and returns it’s value.

Note

The sinus-value of an angle is the ratio between the opposite and the hypotenuse

storage_type cos()

Applies the trigonometric co-sinus function on the angle and returns it’s value.

Note

The co-sinus-value of an angle is the ratio between the adjacent and the hypotenuse

storage_type tan()

Applies the trigonometric tangent function on the angle and returns it’s value.

Note

The tangent-value of an angle is the ratio between the adjacent and the opposite

Public Static Functions

static constexpr angle deg(storage_type value)

Constructs an angle from a degree value.

static constexpr angle rad(storage_type value)

Constructs an angle from a radians value.

static angle arcsin(storage_type v)

Applies the arcsin function to a sin value and constructs and angle from it.

Note

The arcsin is the counterpart to the sinus function and reverses it’s effects.

static angle arccos(storage_type v)

Applies the arccos function to a cos value and constructs and angle from it.

Note

The arccos is the counterpart to the co-sinus function and reverses it’s effects.

static angle arctan(storage_type v)

Applies the arctan function to a tan value and constructs and angle from it.

Note

The arctan is the counterpart to the tangent function and reverses it’s effects.

static angle arctan2(storage_type y, storage_type x)

Applies the arctan2 function to a pair of cartesian coordinates, and returns the polar-angle of those coordinates in respect to the origin (0,0)

Note

The arctan is the counterpart to the tangent function and reverses it’s effects.