SaturnMath++ library functions.
SaturnMath++ is a C++23 library dedicated to Sega Saturn hardware, offering essential mathematical operations tailored for fixed-point arithmetic and geometric calculations.
Project url: Here
Classes | |
class | Integer |
Integer-specific utility functions optimized for performance. More... | |
class | Interpolation |
Class containing interpolation and easing functions optimized for fixed-point arithmetic. More... | |
class | Random |
Pseudo-Random number generator. More... | |
class | Trigonometry |
Core trigonometric functionality using fixed-point arithmetic. More... | |
Enumerations | |
enum class | Precision { Standard , Fast , Turbo } |
Specifies the precision level for mathematical operations. More... | |
enum class | SortOrder { Ascending , Descending } |
Specifies the order for sorting operations. More... | |
Functions | |
template<typename ValueType > | |
static constexpr ValueType | Abs (const ValueType &value) |
Get absolute value. | |
template<typename T > | |
static constexpr T | Clamp (const T &value, const T &min, const T &max) |
Clamps a value between min and max bounds. | |
template<typename ValueType > | |
static constexpr ValueType | Max (const ValueType &first, const ValueType &second) |
Get maximum value of two values. | |
template<typename ValueType > | |
static constexpr ValueType | Min (const ValueType &first, const ValueType &second) |
Get minimum value of two values. | |
|
strong |
Specifies the precision level for mathematical operations.
Different precision levels offer a trade-off between accuracy and performance:
Enumerator | |
---|---|
Standard | Standard precision using full calculations. |
Fast | Fast approximation with good accuracy. |
Turbo | Fastest approximation with acceptable accuracy. |
|
strong |
|
staticconstexpr |
Get absolute value.
Works with any type that supports comparison operators.
ValueType | Type of the value |
value | Numeric value |
|
staticconstexpr |
Clamps a value between min and max bounds.
Works with any type that supports comparison operators.
T | Type of the values |
value | Value to clamp |
min | Minimum allowed value |
max | Maximum allowed value |
|
staticconstexpr |
Get maximum value of two values.
Works with any type that supports comparison operators.
ValueType | Type of the value |
first | First value |
second | Second value |
|
staticconstexpr |
Get minimum value of two values.
Works with any type that supports comparison operators.
ValueType | Type of the value |
first | First value |
second | Second value |