MathLib
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
Math Namespace Reference

Namespaces

namespace  Combinatorics
 
namespace  Literals
 

Classes

class  BasicComplex
 
class  BasicDegree
 
class  BasicDual
 
class  BasicDualQuaternion
 
class  BasicQuaternion
 
class  BasicRadian
 
struct  BasicVector2D
 
struct  BasicVector3D
 
struct  BasicVector4D
 

Functions

bool approximately_equal_to (float input, float near_to, float tolerance=0.0002f)
 
bool approximately_equal_to (double input, double near_to, double tolerance=0.0002)
 
bool approximately_equal_to (long double input, long double near_to, long double tolerance=0.0002l)
 
int three_way_compare (float left, float right, float tolerance=0.0002f)
 
int three_way_compare (double left, double right, double tolerance=0.0002)
 
int three_way_compare (long double left, long double right, long double tolerance=0.0002l)
 
template<std::floating_point T>
constexpr T DegreesToRadians (T degrees)
 Convert degrees to radians.
 
template<std::floating_point T>
constexpr T RadiansToDegrees (T radians)
 Convert radians to degrees.
 
template<class Type >
constexpr Type lerp (Type input_lower_bound, Type input_upper_bound, float percentage_zero_to_one)
 
template<class Type >
constexpr Type mix (Type input_lower_bound, Type input_upper_bound, float percentage_zero_to_one)
 
template<class Type >
constexpr Type inverse_lerp (Type input_lower_bound, Type input_upper_bound, Type value_between)
 
template<class Type >
constexpr Type remap (Type input_value, Type orig_range_min, Type orig_range_max, Type new_range_min, Type new_range_max)
 
template<class Type >
constexpr const Type & saturate (const Type &value, const Type &lower_bound, const Type &upper_bound)
 
template<class Type >
constexpr Type step (Type y, Type x)
 
constexpr float smoothstep (float input_value, float left_edge=0.0f, float right_edge=1.0f)
 
template<class Type >
constexpr Type smootherstep (Type input_value, Type left_edge, Type right_edge)
 
template<class Type = float>
constexpr Type smoothstep_generalized (Type input_value, Type left_edge=0, Type right_edge=1, int Order=1)
 
template<class Type = float>
constexpr Type inverse_smoothstep (Type input_value)
 
template<class Type >
Type fract (Type input)
 
template<class T >
T unnormalized_sinc (T radians)
 
template<class T >
T normalized_sinc (T radians)
 
Check for equality
bool check_if_equal (float input, float near_to, float tolerance=0.0002f)
 
bool check_if_equal (double input, double near_to, double tolerance=0.0002)
 
bool check_if_equal (long double input, long double near_to, long double tolerance=0.0002l)
 
Check for inequality
bool check_if_not_equal (float input, float near_to, float tolerance=0.0002f)
 
bool check_if_not_equal (double input, double near_to, double tolerance=0.0002)
 
bool check_if_not_equal (long double input, long double near_to, long double tolerance=0.0002l)
 
Assert values are equal
void CHECK_IF_EQUAL (float input, float near_to, float tolerance=0.0002f)
 
void CHECK_IF_EQUAL (double input, double near_to, double tolerance=0.0002)
 
void CHECK_IF_EQUAL (long double input, long double near_to, long double tolerance=0.0002l)
 
Assert values are not equal
void CHECK_IF_NOT_EQUAL (float input, float near_to, float tolerance=0.0002f)
 
void CHECK_IF_NOT_EQUAL (double input, double near_to, double tolerance=0.0002)
 
void CHECK_IF_NOT_EQUAL (long double input, long double near_to, long double tolerance=0.0002l)
 
Assert value is zero
void CHECK_IF_ZERO (float input, float tolerance=0.0002f)
 
void CHECK_IF_ZERO (double input, double tolerance=0.0002)
 
void CHECK_IF_ZERO (long double input, long double tolerance=0.0002l)
 

Detailed Description

Contains Mathematical Constructs

Function Documentation

◆ fract()

template<class Type >
Type fract ( Type  input)

Definition at line 156 of file Functions.hpp.

◆ inverse_lerp()

template<class Type >
constexpr Type inverse_lerp ( Type  input_lower_bound,
Type  input_upper_bound,
Type  value_between 
)
inlineconstexpr

Produces the percentage of interpolation of a value within a range

Parameters
input_lower_boundThe lower bound
input_upper_boundThe upper bound
value_betweenA value that you want to find the percentage interpolation of
Returns
The percentage of value_between between input_lower_bound and input_upper_bound

Definition at line 60 of file Functions.hpp.

◆ inverse_smoothstep()

template<class Type = float>
constexpr Type inverse_smoothstep ( Type  input_value)
inlineconstexpr

Definition at line 150 of file Functions.hpp.

◆ lerp()

template<class Type >
constexpr Type lerp ( Type  input_lower_bound,
Type  input_upper_bound,
float  percentage_zero_to_one 
)
inlineconstexpr

Linear interpolate a value from a lower bound to an upper bound

Parameters
input_lower_boundThe lower bound
input_upper_boundThe upper bound
percentage_zero_to_oneThe percentage along the interpolation

Definition at line 26 of file Functions.hpp.

◆ mix()

template<class Type >
constexpr Type mix ( Type  input_lower_bound,
Type  input_upper_bound,
float  percentage_zero_to_one 
)
inlineconstexpr

Linear interpolate a value from a lower bound to an upper bound

Parameters
input_lower_boundThe lower bound
input_upper_boundThe upper bound
percentage_zero_to_oneThe percentage along the interpolation
Note
This is identical to the lerp function.
See also
lerp

Definition at line 46 of file Functions.hpp.

◆ normalized_sinc()

template<class T >
T normalized_sinc ( T  radians)
inline

Definition at line 25 of file Trigonometric.hpp.

◆ remap()

template<class Type >
constexpr Type remap ( Type  input_value,
Type  orig_range_min,
Type  orig_range_max,
Type  new_range_min,
Type  new_range_max 
)
inlineconstexpr

Map an input value within a range to a new range

This will give you the input_value adjusted to within a new range of values, keeping the percentage of the input_value within the original range in the new range.

Parameters
input_valueThe input value
orig_range_minThe original range's minimum value
orig_range_maxThe original range's maximum value
new_range_minThe new range's minimum value
new_range_maxThe new range's minimum value
Returns
The input value mapped to a the new range

Definition at line 80 of file Functions.hpp.

◆ saturate()

template<class Type >
constexpr const Type & saturate ( const Type &  value,
const Type &  lower_bound,
const Type &  upper_bound 
)
inlineconstexpr

Saturate a value to within a range

Parameters
valueThe value to saturate
lower_boundThe minimum value to clamp to
upper_boundThe maximum value to clamp to
Returns
The value clamped to within the given bounds

Definition at line 94 of file Functions.hpp.

◆ smootherstep()

template<class Type >
constexpr Type smootherstep ( Type  input_value,
Type  left_edge,
Type  right_edge 
)
inlineconstexpr

Definition at line 115 of file Functions.hpp.

◆ smoothstep()

constexpr float smoothstep ( float  input_value,
float  left_edge = 0.0f,
float  right_edge = 1.0f 
)
inlineconstexpr

Definition at line 105 of file Functions.hpp.

◆ smoothstep_generalized()

template<class Type = float>
constexpr Type smoothstep_generalized ( Type  input_value,
Type  left_edge = 0,
Type  right_edge = 1,
int  Order = 1 
)
inlineconstexpr

Definition at line 126 of file Functions.hpp.

◆ step()

template<class Type >
constexpr Type step ( Type  y,
Type  x 
)
inlineconstexpr

Definition at line 100 of file Functions.hpp.

◆ unnormalized_sinc()

template<class T >
T unnormalized_sinc ( T  radians)
inline

Definition at line 16 of file Trigonometric.hpp.