Math modul. More...
#include <math.hpp>
Public Member Functions | |
math ()=delete | |
Deleted explicit constructor. | |
Static Public Member Functions | |
static constexpr float | epsilon () |
Single precision epsilon. | |
static constexpr float | pi () |
Single precision PI. | |
static constexpr float | to_radians (float degrees) |
Converts degrees to radians. | |
static constexpr float | to_degrees (float radians) |
Converts radians to degrees. | |
static constexpr std::pair< float, float > | normal (float x, float y) |
Returns the normal vector of a vector. | |
static float | length (float x, float y) |
Returns the length of a vector. | |
static float | angle (float x, float y) |
Returns the angle of a vector. | |
static std::pair< float, float > | normalize (float x, float y) |
Normalizes a vector. | |
static float | move_x (float length, float angle) |
Moves the x component of a vector. | |
static float | move_y (float length, float angle) |
Moves the y component of a vector. | |
static std::array< float, 4 > | transformation_matrix (float angle, float scale) |
Creates a transformation matrix. | |
static constexpr float | transform_x (float x, float y, std::array< float, 4 > const &transformation_matrix) |
Transforms the x component of a vector. | |
static constexpr float | transform_y (float x, float y, std::array< float, 4 > const &transformation_matrix) |
Transforms the y component of a vector. | |
template<typename T > | |
static T | random (T minimum=std::numeric_limits< T >::lowest(), T maximum=std::numeric_limits< T >::max()) |
Returns a random numeric value from an interval. | |
template<typename T > | |
static bool | random (float probability=(float) true/2) |
Returns a random boolean value. | |
|
inlinestaticnodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
inlinestaticnodiscardconstexpr |
|
staticnodiscard |
|
staticnodiscard |
|
staticnodiscard |
Normalizes a vector.
x | X component of the vector. |
y | Y component of the vector. |
Definition at line 41 of file math.cpp.
|
staticnodiscard |
Moves the x component of a vector.
length | Length of the movement. |
angle | Angle of the movement. |
|
staticnodiscard |
|
staticnodiscard |
Creates a transformation matrix.
angle | Angle of the transformation matrix. |
scale | Scale of the transformation matrix. |
|
inlinestaticnodiscardconstexpr |
Transforms the x component of a vector.
x | X component of the vector. |
y | Y component of the vector. |
transformation_matrix | Transformation matrix. |
Definition at line 148 of file math.hpp.
|
inlinestaticnodiscardconstexpr |
Transforms the y component of a vector.
x | X component of the vector. |
y | Y component of the vector. |
transformation_matrix | Transformation matrix. |
|
inlinestaticnodiscard |
Returns a random numeric value from an interval.
T | Numeric type. |
minimum | Minimum inclusive value of the interval. |
maximum | Maximum inclusive value of the interval. |
Definition at line 176 of file math.hpp.
|
inlinestaticnodiscard |