|
| 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.
|
| constexpr f32 | Crux::Radians (f32 degrees) |
| | Convert degrees to radians.
|
| constexpr Vector< f32, 3 > | Crux::Radians (Vector< f32, 3 > vector) |
| | Convert a Vector3s components from degrees to radians.
|
| constexpr f32 | Crux::Degrees (f32 radians) |
| | Convert radians to degrees.
|
| template<typename T> |
| constexpr Vector< T, 3 > | Crux::Degrees (Vector< T, 3 > vector) |
| | Convert a Vector3s components from radians to degrees.
|
| template<Detail::PrecisionMode Mode = Detail::PrecisionMode::Standard> |
| f32 | Crux::Sin (f32 radians) |
| | Computes the sine of an angle in radians using a fast polynomial approximation.
|
| template<Detail::PrecisionMode Mode = Detail::PrecisionMode::Standard> |
| f32 | Crux::Cos (f32 radians) |
| | Computes the cosine of an angle in radians using a fast polynomial approximation.
|
| template<Detail::PrecisionMode Mode = Detail::PrecisionMode::Standard> |
| f32 | Crux::Tan (f32 radians) |
| | Computes the tangent of an angle in radians using a fast polynomial approximation.
|
Mathematical operations and algorithms.
Houses core arithmetic and math utilities.
| f32 Crux::Tan |
( |
f32 | radians | ) |
|
|
inline |
Computes the tangent of an angle in radians using a fast polynomial approximation.
Performs a branchless range-reduction into [-pi/4, pi/4], evaluates minimax polynomials for both sine and cosine of degree determined by the PrecisionMode template (Standard=7), applies quadrant-based transformations, and computes the ratio sin/cos.
This implementation is optimized to share the range reduction and polynomial evaluation between the sine and cosine components, making it more efficient than calling Sin and Cos separately.
- Template Parameters
-
| PrecisionMode | Selects the polynomial degree:
- Fast (degree 5)
- Standard (degree 7, default)
- High (degree 9) It is recommended to use Standard for most applications.
|
- Parameters
-
- Returns
- Approximation of tan(radians).
- Note
- This uses the internal Detail::ReduceAngle, Detail::PolySin<PrecisionMode>, and Detail::PolyCos<PrecisionMode> routines.
-
The result is undefined at odd multiples of pi/2 where cos(radians) = 0.
- See also
- Detail::ReduceAngle, Detail::PolySin, Detail::PolyCos