|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Lightweight math utility functions used throughout the engine. More...
Functions | |
| float | clamp (float d, float min, float max) |
Clamps d to the inclusive range [min, max]. | |
| size_t | HashCombine (size_t lhs, size_t rhs) |
| Combines two size_t hash values into a single hash. | |
| template<typename Numeric > | |
| bool | IsNumber (const std::string &s) |
Returns true if s represents a valid number of type Numeric. | |
Lightweight math utility functions used throughout the engine.
| float Ship::Math::clamp | ( | float | d, |
| float | min, | ||
| float | max | ||
| ) |
Clamps d to the inclusive range [min, max].
| d | Value to clamp. |
| min | Lower bound. |
| max | Upper bound. |
min if d < min, max if d > max, otherwise d. | size_t Ship::Math::HashCombine | ( | size_t | lhs, |
| size_t | rhs | ||
| ) |
Combines two size_t hash values into a single hash.
Implements the standard "hash combine" technique from Boost: the result is sensitive to the order of arguments, so HashCombine(a, b) != HashCombine(b, a).
| lhs | First hash value. |
| rhs | Second hash value. |
| bool Ship::Math::IsNumber | ( | const std::string & | s | ) |
Returns true if s represents a valid number of type Numeric.
Attempts to parse s using the standard stream extraction operator. Returns true only if parsing succeeds and consumes the entire string.
| Numeric | Numeric type to test against (e.g. int, float, double). |
| s | String to test. |