A BPY plus module with useful math functions
Functions
clip(value, _min=0.0, _max=1.0)
Clip value by the _min … _max boundaries.
Parameters:
value: processing value
_min: the lower boundary
_max: the top boundary
Returns:
If the value goes beyond the boundaries – the value itself, and if not – the maximum possible boundary value.
1 2 3 4 |
from bpy_plus.math import clip print(clip(value=15, _min=0, _max=10)) # 10 |
range(value, min_src=0.0, max_src=1.0, min_dest=0.0, max_dest=1.0)
Converts the value from the min_src … max_src range to the min_dest .. .max_dest range
Parameters:
value: processing value
_min_src: the lower source range boundary
_max_src: the top source range boundary
_min_dest: the lower destination range boundary
_max_dest: the top destination range boundary
Returns:
The value in the new range.
1 2 3 4 |
from bpy_plus.math import range print(range(value=15, min_src=0, max_src=100, min_dest=-1, max_dest=1)) # -0.7 |