MinitScript  0.9.31 PRE-BETA
Static Public Member Functions | Static Public Attributes | List of all members
Math Class Referencefinal

Standard math functions. More...

#include <minitscript/math/Math.h>

Collaboration diagram for Math:
Collaboration graph

Static Public Member Functions

static auto clamp (auto value, auto min, auto max)
 Clamps a value to min or max value. More...
 
static auto sign (auto value)
 Returns sign of value. More...
 
static auto square (auto value)
 Do the square product. More...
 
static auto abs (auto value)
 Returns absolute value. More...
 
static float acos (float x)
 Returns the arc cosine of x. More...
 
static float asin (float x)
 Returns the arc sine of x. More...
 
static float atan (float x)
 Returns the arc tangent of x. More...
 
static float atan2 (float y, float x)
 Returns the angle from the conversion of rectangular coordinates to polar coordinates. More...
 
static float ceil (float value)
 Returns the higher integer value of given value. More...
 
static float cos (float x)
 Returns the cosine of x. More...
 
static float floor (float value)
 Returns the lower integer value of given value. More...
 
static auto max (auto value1, auto value2)
 Returns the higher value of given values. More...
 
static auto min (auto value1, auto value2)
 Returns the lesser value of given values. More...
 
static float round (float value)
 Returns the rounded value of given float value. More...
 
static auto pow (auto base, auto power)
 Returns the value of base raised to the power. More...
 
static float random ()
 Returns a random value between 0.0 . More...
 
static float sin (float x)
 Returns the sine of x. More...
 
static float sqrt (float value)
 Returns the square root of given value. More...
 
static float tan (float x)
 Returns the tangent of x. More...
 
static float exp (float power)
 Returns e raised to the given power. More...
 
static float log (float value)
 Returns the natural (base e) logarithm of value. More...
 
static auto mod (auto value, auto range)
 Returns modulo of value, so that return value is -range < value < range. More...
 
static float mod (float value, float range)
 Returns modulo of value, so that return value is -range < value < range. More...
 
static auto absmod (auto value, auto range)
 Returns absolute modulo of value, so that return value is 0 <= value < range. More...
 
static float absmod (float value, float range)
 Returns absolute modulo of value, so that return value is 0.0f <= value < range. More...
 

Static Public Attributes

static constexpr float PI { 3.141592653589793f }
 
static constexpr float EPSILON { 0.0000001f }
 
static constexpr float DEG2RAD { 0.017453294f }
 
static constexpr float G { 9.80665f }
 

Detailed Description

Standard math functions.

Author
Andreas Drewke

Definition at line 18 of file Math.h.

Member Function Documentation

◆ clamp()

static auto clamp ( auto  value,
auto  min,
auto  max 
)
inlinestatic

Clamps a value to min or max value.

Parameters
valuevalue
minmin value
maxmax value
Returns
clamped value

Definition at line 33 of file Math.h.

◆ sign()

static auto sign ( auto  value)
inlinestatic

Returns sign of value.

Parameters
valuevalue
Returns
-1 if value is negative or +1 if positive

Definition at line 44 of file Math.h.

◆ square()

static auto square ( auto  value)
inlinestatic

Do the square product.

Parameters
valuevalue
Returns
square product

Definition at line 54 of file Math.h.

◆ abs()

static auto abs ( auto  value)
inlinestatic

Returns absolute value.

Parameters
valuevalue
Returns
absolute value

Definition at line 63 of file Math.h.

◆ acos()

static float acos ( float  x)
inlinestatic

Returns the arc cosine of x.

Parameters
xx
Returns
arc cosine of x

Definition at line 72 of file Math.h.

◆ asin()

static float asin ( float  x)
inlinestatic

Returns the arc sine of x.

Parameters
xx
Returns
arc sine of x

Definition at line 81 of file Math.h.

◆ atan()

static float atan ( float  x)
inlinestatic

Returns the arc tangent of x.

Parameters
xx
Returns
arc tangent of x

Definition at line 90 of file Math.h.

◆ atan2()

static float atan2 ( float  y,
float  x 
)
inlinestatic

Returns the angle from the conversion of rectangular coordinates to polar coordinates.

Parameters
yy
xx
Returns
arc tangent of y/x

Definition at line 100 of file Math.h.

◆ ceil()

static float ceil ( float  value)
inlinestatic

Returns the higher integer value of given value.

Parameters
valuevalue
Returns
higher integer

Definition at line 109 of file Math.h.

◆ cos()

static float cos ( float  x)
inlinestatic

Returns the cosine of x.

Parameters
xx
Returns
cosine of x

Definition at line 118 of file Math.h.

◆ floor()

static float floor ( float  value)
inlinestatic

Returns the lower integer value of given value.

Parameters
valuevalue
Returns
lower integer

Definition at line 127 of file Math.h.

◆ max()

static auto max ( auto  value1,
auto  value2 
)
inlinestatic

Returns the higher value of given values.

Parameters
value1value 1
value2value 2
Returns
higher value

Definition at line 137 of file Math.h.

◆ min()

static auto min ( auto  value1,
auto  value2 
)
inlinestatic

Returns the lesser value of given values.

Parameters
value1value 1
value2value 2
Returns
lesser value

Definition at line 147 of file Math.h.

◆ round()

static float round ( float  value)
inlinestatic

Returns the rounded value of given float value.

Parameters
valuevalue
Returns
rounded value

Definition at line 156 of file Math.h.

◆ pow()

static auto pow ( auto  base,
auto  power 
)
inlinestatic

Returns the value of base raised to the power.

Parameters
basebase
powerpower
Returns
base raised to the power

Definition at line 166 of file Math.h.

◆ random()

static float random ( )
inlinestatic

Returns a random value between 0.0 .

. 1.0

Returns
random value

Definition at line 174 of file Math.h.

◆ sin()

static float sin ( float  x)
inlinestatic

Returns the sine of x.

Parameters
xx
Returns
sin of x

Definition at line 183 of file Math.h.

◆ sqrt()

static float sqrt ( float  value)
inlinestatic

Returns the square root of given value.

Parameters
valuevalue
Returns
square root of value

Definition at line 192 of file Math.h.

◆ tan()

static float tan ( float  x)
inlinestatic

Returns the tangent of x.

Parameters
xx
Returns
tangent of x

Definition at line 201 of file Math.h.

◆ exp()

static float exp ( float  power)
inlinestatic

Returns e raised to the given power.

Parameters
powerpower
Returns
e raised to the given power

Definition at line 210 of file Math.h.

◆ log()

static float log ( float  value)
inlinestatic

Returns the natural (base e) logarithm of value.

Parameters
valuevalue
Returns
natural (base e) logarithm of value

Definition at line 219 of file Math.h.

◆ mod() [1/2]

static auto mod ( auto  value,
auto  range 
)
inlinestatic

Returns modulo of value, so that return value is -range < value < range.

Parameters
valuevalue
rangerange
Returns
modulo of value

Definition at line 229 of file Math.h.

◆ mod() [2/2]

static float mod ( float  value,
float  range 
)
inlinestatic

Returns modulo of value, so that return value is -range < value < range.

Parameters
valuevalue
rangerange
Returns
modulo of value

Definition at line 239 of file Math.h.

◆ absmod() [1/2]

static auto absmod ( auto  value,
auto  range 
)
inlinestatic

Returns absolute modulo of value, so that return value is 0 <= value < range.

Parameters
valuevalue
rangerange
Returns
modulo of value

Definition at line 249 of file Math.h.

◆ absmod() [2/2]

static float absmod ( float  value,
float  range 
)
inlinestatic

Returns absolute modulo of value, so that return value is 0.0f <= value < range.

Parameters
valuevalue
rangerange
Returns
modulo of value

Definition at line 261 of file Math.h.

Member Data Documentation

◆ PI

constexpr float PI { 3.141592653589793f }
staticconstexpr

Definition at line 21 of file Math.h.

◆ EPSILON

constexpr float EPSILON { 0.0000001f }
staticconstexpr

Definition at line 22 of file Math.h.

◆ DEG2RAD

constexpr float DEG2RAD { 0.017453294f }
staticconstexpr

Definition at line 23 of file Math.h.

◆ G

constexpr float G { 9.80665f }
staticconstexpr

Definition at line 24 of file Math.h.


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