template<typename T>
MathCalcCommon class
Public types
- struct AtanSample
- struct ExpSample
- struct LogSample
- struct SinCosSample
Public static variables
- static const u32 cQuarterRoundIdx
- static const u32 cHalfRoundIdx
- static const SinCosSample cSinCosTbl
- Note: this is only defined for T = float at the moment.
- static const AtanSample cAtanTbl
- static const ExpSample cExpTbl
- static const LogSample cLogTbl
Public static functions
- static auto piHalf() -> T
- static auto pi() -> T
- static auto pi2() -> T
- static auto zero() -> T
- static auto one() -> T
- static auto ln2() -> T
- static auto ln2Inv() -> T
- static auto neg(T t) -> T
- static auto inv(T t) -> T
- static auto sign(T value) -> T
- Returns -1 for strictly negative values and 1 otherwise.
- static auto fitSign(T value, T sign_value) -> T
- static auto square(T t) -> T
- static auto sqrt(T t) -> T
- static auto rsqrt(T t) -> T
- static auto pow(T x, T y) -> T
- static auto powTable(T, T) -> T
- static auto sin(T t) -> T
- static auto cos(T t) -> T
- static auto tan(T t) -> T
- static auto asin(T s) -> T
- static auto acos(T c) -> T
- static auto atan(T t) -> T
- static auto atan2(T y, T x) -> T
- static auto sinIdx(u32 idx) -> T
- static auto cosIdx(u32 idx) -> T
- static auto tanIdx(u32 idx) -> T
- static auto asinIdx(T s) -> u32
- static auto acosIdx(T c) -> u32
- static auto atanIdx(T t) -> u32
- static auto atan2Idx(T y, T x) -> u32
- static void sinCosIdx(T* p_sin, T* p_cos, u32 idx)
- static auto exp(T t) -> T
- static auto log(T t) -> T
- static auto log2(T n) -> T
- static auto log10(T t) -> T
- static auto expTable(T x) -> T
- static auto logTable(T x) -> T
- static auto minNumber() -> T
- static auto maxNumber() -> T
- static auto infinity() -> T
- static auto nan() -> T
- static auto epsilon() -> T
- static auto equalsEpsilon(T lhs, T rhs, T eps = epsilon()) -> bool
- static auto abs(T x) -> T
- static auto max(T a, T b) -> T
- static auto min(T a, T b) -> T
- static auto max3(T a, T b, T c) -> T
- static auto min3(T a, T b, T c) -> T
- static auto deg2rad(T deg) -> T
- static auto rad2deg(T rad) -> T
- static auto deg2idx(T a) -> u32
- static auto rad2idx(T a) -> u32
- static auto idx2deg(u32 a) -> T
- static auto idx2rad(u32 a) -> T
- static auto roundAngle(T) -> T
- static auto angleDist(T, T) -> T
- static auto random() -> T
- static auto getRand(T) -> T
- static auto getRandRange(T, T) -> T
- static auto getRandSign() -> T
- static auto roundOff(T) -> s32
- static auto floor(T) -> s32
- static auto ceil(T) -> s32
- static auto roundUp(T x, s32 multNumber) -> T
- static auto roundUpPow2(T x, s32 y) -> s32
- static auto roundDownN(T val, s32 multNumber) -> s32
- static auto roundDownPow2(T x, s32 y) -> s32
- static auto clampMax(T val, T max_) -> T
- static auto clampMin(T val, T min_) -> T
- static auto clamp(T value, T low, T high) -> T
- static auto clamp2(T min_, T val, T max_) -> T
- static auto gcd(T x, T y) -> T
- static auto lcm(T x, T y) -> T
- static auto isZero(T, T) -> bool
- static auto isNan(T) -> bool
- static auto isPow2(T) -> bool
- static auto isMultiplePow2(T, T) -> bool
- static auto isInfinity(T) -> bool
- static auto isIntersect1d(T, T, T, T) -> bool
- static auto chase(T* value, T target, T step) -> bool
- static auto chaseAngle(T*, T, T) -> bool
- static auto chaseAngleIdx(u32*, u32, s64) -> bool
- static auto lerp(T a, T b, f32 ratio) -> T
Public functions
- auto sinIdx(u32 idx) -> f32
- auto cosIdx(u32 idx) -> f32
- auto tanIdx(u32 idx) -> f32
- auto asinIdx(f32 s) -> u32
- auto acosIdx(f32 c) -> u32
- auto atanIdx(f32 t) -> u32
- auto atan2Idx(f32 y, f32 x) -> u32
- void sinCosIdx(f32* pSin, f32* pCos, u32 idx)
- auto minNumber() -> float
- auto maxNumber() -> float
- auto minNumber() -> double
- auto maxNumber() -> double
- auto minNumber() -> long double
- auto maxNumber() -> long double
- auto nan() -> f32
- auto nan() -> f64
- auto abs(s32 x) -> s32
- auto abs(u32 x) -> u32
- auto roundOff(s32 val) -> s32
- auto floor(s32 val) -> s32
- auto ceil(s32 val) -> s32
- auto roundUpPow2(u32 val, s32 base) -> s32
- auto roundUpPow2(s32 val, s32 base) -> s32
Protected static functions
- static auto atanIdx_(T t) -> u32
- static auto expLn2_(T x) -> T
- static auto log1_2_(T x) -> T
- static void assertGreaterThanOrEqualToZero_(T)
Protected functions
Function documentation
template<typename T>
static bool sead:: MathCalcCommon<T>:: chase(T* value,
T target,
T step)
Adds or subtracts step from value towards target. Returns whether the new value is equal to the target.
#include <math/seadMathCalcCommon.hpp>
template<typename T>
f32 sead:: MathCalcCommon<T>:: sinIdx(u32 idx)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
f32 sead:: MathCalcCommon<T>:: cosIdx(u32 idx)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
f32 sead:: MathCalcCommon<T>:: tanIdx(u32 idx)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
u32 sead:: MathCalcCommon<T>:: asinIdx(f32 s)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
u32 sead:: MathCalcCommon<T>:: acosIdx(f32 c)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
u32 sead:: MathCalcCommon<T>:: atanIdx(f32 t)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
u32 sead:: MathCalcCommon<T>:: atan2Idx(f32 y,
f32 x)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
void sead:: MathCalcCommon<T>:: sinCosIdx(f32* pSin,
f32* pCos,
u32 idx)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
float sead:: MathCalcCommon<T>:: minNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
float sead:: MathCalcCommon<T>:: maxNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
double sead:: MathCalcCommon<T>:: minNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
double sead:: MathCalcCommon<T>:: maxNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
long double sead:: MathCalcCommon<T>:: minNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
long double sead:: MathCalcCommon<T>:: maxNumber()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
f32 sead:: MathCalcCommon<T>:: nan()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
f64 sead:: MathCalcCommon<T>:: nan()
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: abs(s32 x)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
u32 sead:: MathCalcCommon<T>:: abs(u32 x)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: roundOff(s32 val)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: floor(s32 val)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: ceil(s32 val)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: roundUpPow2(u32 val,
s32 base)
#include <math/seadMathCalcCommon.hpp>
template<typename T>
s32 sead:: MathCalcCommon<T>:: roundUpPow2(s32 val,
s32 base)