Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
BasicMath.h File Reference
#include "Crux/Utils/Constants.h"
#include <bit>
#include <immintrin.h>

Namespaces

namespace  Crux

Functions

template<typename T>
constexpr T Crux::Lerp (T a, T b, f32 t)
 Linear interpolation between a and b by factor t.
template<typename T>
constexpr T Crux::Min (T a, T b)
 Return the minimum of two values.
template<typename T>
constexpr T Crux::Max (T a, T b)
 Return the maximum of two values.
template<typename T>
constexpr T Crux::Clamp (T value, T min, T max)
 Clamp a value between a minimum and maximum.
template<typename T>
constexpr T Crux::Saturate (T value)
 Clamp a value to the [0,1] range.
template<typename T>
constexpr T Crux::Sign (T value)
 Signum function: returns -1, 0, or +1.
template<typename T>
constexpr T Crux::Abs (T value)
 Absolute value.
template<typename T>
constexpr T Crux::Floor (T value)
 Floor function for f32ing-point values.
template<typename T>
constexpr T Crux::Ceil (T value)
 Ceiling function for f32ing-point values.
template<typename T>
constexpr T Crux::Fract (T value)
 Fractional part of a value.
template<typename T>
constexpr T Crux::Square (T value)
 Square of a value.
template<typename T>
constexpr T Crux::Cube (T value)
 Cube of a value.
constexpr f32 Crux::Smoothstep (f32 edge0, f32 edge1, f32 x)
 Smoothstep interpolation between edge0 and edge1.
constexpr f32 Crux::CTInverseSqrt (f32 x)
 Fast compile-time inverse square root (single Newton step).
constexpr f32 Crux::CTSqrt (const f32 x)
 Fast compile-time square root using bit manipulation.
f32 Crux::InverseSqrt (const f32 x)
 Inverse square root using hardware rsqrt.
f32 Crux::Sqrt (const f32 x)
 Standard square root using hardware sqrt.