![]() |
Raven Engine v0.1
|
Mathematical operations and algorithms. More...
Files | |
| file | TrigPolyImpl.inl |
| Estrin-based polynomial evaluation for sine and cosine. | |
Functions | |
| template<typename T> | |
| constexpr T | Crux::Lerp (T a, T b, float 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 floating-point values. | |
| template<typename T> | |
| constexpr T | Crux::Ceil (T value) |
| Ceiling function for floating-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 float | Crux::Smoothstep (float edge0, float edge1, float x) |
| Smoothstep interpolation between edge0 and edge1. | |
| constexpr float | Crux::CTInverseSqrt (float x) |
| Fast compile-time inverse square root (single Newton step). | |
| constexpr float | Crux::CTSqrt (const float x) |
| Fast compile-time square root using bit manipulation. | |
| float | Crux::InverseSqrt (const float x) |
| Inverse square root using hardware rsqrt. | |
| float | Crux::Sqrt (const float x) |
| Standard square root using hardware sqrt. | |
| constexpr float | Crux::Radians (float degrees) |
| Convert degrees to radians. | |
| constexpr Vector< float, 3 > | Crux::Radians (Vector< float, 3 > vector) |
| Convert a Vector3s components from degrees to radians. | |
| constexpr float | Crux::Degrees (float radians) |
| Convert radians to degrees. | |
| constexpr Vector< float, 3 > | Crux::Degrees (Vector< float, 3 > vector) |
| Convert a Vector3s components from radians to degrees. | |
| template<Detail::PrecisionMode Mode = Detail::PrecisionMode::Standard> | |
| float | Crux::Sin (float radians) |
| Computes the sine of an angle in radians using a fast polynomial approximation. | |
| template<Detail::PrecisionMode Mode = Detail::PrecisionMode::Standard> | |
| float | Crux::Cos (float radians) |
| Computes the cosine of an angle in radians using a fast polynomial approximation. | |
Mathematical operations and algorithms.
Houses core arithmetic and math utilities.
|
inlineconstexpr |
Absolute value.
| T | Arithmetic type. |
| value | Input value. |
|
inlineconstexpr |
Ceiling function for floating-point values.
| T | Floating-point type. |
| value | Input value. |
|
inlineconstexpr |
Clamp a value between a minimum and maximum.
| T | Arithmetic type. |
| value | Input value. |
| min | Minimum allowed. |
| max | Maximum allowed. |
|
inline |
Computes the cosine of an angle in radians using a fast polynomial approximation.
Performs a branchless range-reduction into [-pi/4, pi/4], shifts the quadrant index for the pi/2 phase offset (cos(x)=sin(x+pi/2)), evaluates a minimax polynomial of degree determined by the PrecisionMode template (Standard=7), and applies the correct sign.
| PrecisionMode | Selects the polynomial degree:
|
| radians | Angle in radians. |
|
inlineconstexpr |
Fast compile-time inverse square root (single Newton step).
| x | Input value. |
|
inlineconstexpr |
Fast compile-time square root using bit manipulation.
| x | Input value. |
|
inlineconstexpr |
Cube of a value.
| T | Arithmetic type. |
| value | Input value. |
|
inlineconstexpr |
Convert radians to degrees.
| radians | Angle in radians. |
Convert a Vector3s components from radians to degrees.
| vector | The Vector to convert |
|
inlineconstexpr |
Floor function for floating-point values.
| T | Floating-point type. |
| value | Input value. |
|
inlineconstexpr |
Fractional part of a value.
| T | Floating-point type. |
| value | Input value. |
|
inline |
Inverse square root using hardware rsqrt.
| x | Input value. |
|
inlineconstexpr |
Linear interpolation between a and b by factor t.
| T | Arithmetic type of endpoints. |
| a | Start value. |
| b | End value. |
| t | Interpolation factor in [0,1]. |
|
inlineconstexpr |
Return the maximum of two values.
| T | Arithmetic type. |
| a | First value. |
| b | Second value. |
|
inlineconstexpr |
Return the minimum of two values.
| T | Arithmetic type. |
| a | First value. |
| b | Second value. |
|
inlineconstexpr |
Convert degrees to radians.
| degrees | Angle in degrees. |
Convert a Vector3s components from degrees to radians.
| vector | The Vector to convert |
|
inlineconstexpr |
Clamp a value to the [0,1] range.
| T | Arithmetic type. |
| value | Input value. |
|
inlineconstexpr |
Signum function: returns -1, 0, or +1.
| T | Arithmetic type. |
| value | Input value. |
|
inline |
Computes the sine of an angle in radians using a fast polynomial approximation.
Performs a branchless range-reduction into [-pi/4, pi/4], evaluates a minimax polynomial of degree determined by the PrecisionMode template (Standard=7), and applies the correct sign based on the original quadrant.
| PrecisionMode | Selects the polynomial degree:
|
It is recommended to use Standard for most applications.
| radians | Angle in radians. |
|
inlineconstexpr |
Smoothstep interpolation between edge0 and edge1.
| edge0 | Lower edge of interpolation. |
| edge1 | Upper edge of interpolation. |
| x | Value to interpolate. |
|
inline |
Standard square root using hardware sqrt.
| x | Input value. |
|
inlineconstexpr |
Square of a value.
| T | Arithmetic type. |
| value | Input value. |