A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Math.hh File Reference

Go to the source code of this file.

Classes

struct  SinCosEntry
struct  AtanEntry
struct  BaseAndDec32
struct  BaseAndDec64
union  c32
union  c64

Namespaces

namespace  Kinoko
namespace  Kinoko::EGG
 EGG core library.
namespace  Kinoko::EGG::Mathf
 Math functions and constants used in the base game.

Functions

static constexpr f64 force25Bit (f64 x)
 This is used to mimic the Wii's floating-point unit.
static constexpr f32 fma (f32 x, f32 y, f32 z)
 Fused multiply-add operation.
static constexpr f32 fms (f32 x, f32 y, f32 z)
 Fused multiply-subtract operation.
static constexpr f32 SinFIdx (f32 fidx)
static constexpr f32 CosFIdx (f32 fidx)
static constexpr std::pair< f32, f32 > SinCosFIdx (f32 fidx)
static constexpr f32 AtanFIdx_ (f32 x)
static constexpr f32 Atan2FIdx (f32 y, f32 x)
static constexpr f32 sin (f32 x)
static constexpr f32 cos (f32 x)
static constexpr f32 asin (f32 x)
static constexpr f32 acos (f32 x)
static constexpr f32 atan2 (f32 y, f32 x)
static constexpr f32 abs (f32 x)
static constexpr f64 frsqrte (const f64 val)
static constexpr f32 fres (const f32 val)
static constexpr f32 frsqrt (f32 x)
static constexpr f32 sqrt (f32 x)
static constexpr u32 FindRootsQuadratic (f32 a, f32 b, f32 c, f32 &root1, f32 &root2)
static constexpr f32 finv (f32 x)
 Fused Newton-Raphson operation.
static constexpr f32 Hermite (f32 p0, f32 m0, f32 p1, f32 m1, f32 t)
 Evaluates a cubic Hermite curve at a given parameter t.

Variables

static constexpr f32 F_PI = 3.1415927f
 Floating point representation of pi.
static constexpr f32 F_TAU = 6.2831855f
 Floating point representation of tau/2pi.
static constexpr f32 DEG2RAD = 0.017453292f
 F_PI / 180.0f. Double precision and casted down.
static constexpr f32 DEG2RAD360 = 0.034906585f
 F_PI / 360.0f. Double precision, casted down.
static constexpr f32 RAD2DEG = 57.2957795f
 180.0f / F_PI. Double precision and casted down.
static constexpr f32 DEG2FIDX = 256.0f / 360.0f
 Degrees to fixed index.
static constexpr f32 RAD2FIDX = 128.0f / F_PI
 Radians to fixed index.
static constexpr f32 FIDX2RAD = F_PI / 128.0f
 Fixed index to radians.
static constexpr f32 HALF_PI = F_PI / 2.0f
static constexpr SinCosEntry sSinCosTbl [256+1]
static constexpr AtanEntry sArcTanTbl [32+1]
static constexpr u64 EXPONENT_SHIFT_F64 = 52
static constexpr u64 MANTISSA_MASK_F64 = 0x000fffffffffffffULL
static constexpr u64 EXPONENT_MASK_F64 = 0x7ff0000000000000ULL
static constexpr u64 SIGN_MASK_F64 = 0x8000000000000000ULL
static constexpr std::array< BaseAndDec64, 32 > RSQRTE_TABLE
static constexpr std::array< BaseAndDec32, 32 > FRES_TABLE