game.utils.math_helpers
utils/math_helpers.py
Simple math utilities/helpers.
Functions
|
Clamp a value between min_value and max_value. |
|
Normalize value to range [0,1] with given min_value and max_value bounds. |
|
Scale a 0-1 ratio to an integer index in range [0, size-1]. |
- game.utils.math_helpers.clamp(value, min_value, max_value)
Clamp a value between min_value and max_value.
- game.utils.math_helpers.normalize(value: float, min_value: float, max_value: float) float
Normalize value to range [0,1] with given min_value and max_value bounds.
- game.utils.math_helpers.scale_to_index(ratio: float, size: int) int
Scale a 0-1 ratio to an integer index in range [0, size-1].