Created
November 12, 2020 18:47
-
-
Save viktorasm/11f11c2fe29ad615702075ea51575cb7 to your computer and use it in GitHub Desktop.
linear-to-smooth curve mapping, based on a paper https://arxiv.org/abs/2010.09714
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def curve_mapping(x, s, t): | |
""" | |
provides a linear-to-smooth curve mapping | |
based on a paper https://arxiv.org/abs/2010.09714 | |
""" | |
epsilon = 0.000001 | |
if x < 0: | |
return 0 | |
if x > 1: | |
return 1 | |
if x < t: | |
return (t * x) / (x + s * (t - x) + epsilon) | |
return ((1 - t) * (x - 1)) / (1 - x - s * (t - x) + epsilon) + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment