Rework assertion per feedback

This commit is contained in:
Cosimo Lupo 2022-10-13 19:17:33 +01:00
parent 3c935f95ca
commit 040fdb03a0
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8

View File

@ -67,11 +67,12 @@ def normalizeValue(v, triple, extrapolate=False):
if (v < default and lower != default) or (v > default and upper == default):
return (v - default) / (default - lower)
elif (v > default and upper != default) or (v < default and lower == default):
else:
assert (v > default and upper != default) or (
v < default and lower == default
), f"Ooops... v={v}, triple=({lower}, {default}, {upper})"
return (v - default) / (upper - default)
raise AssertionError("that's not possible")
def normalizeLocation(location, axes, extrapolate=False):
"""Normalizes location based on axis min/default/max values from axes.