Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cubic_dead_zone_func(dead_zone, expo_level):
- """
- Change input axis to be on "expo curve" with a dead zone. Makes the input somewhere
- between linear and cubic.
- Args:
- dead_zone (float, [0, 1)): The amount of input for which there is 0 output.
- expo_level (float, [0, 1]): Interpolates between a linear and cubic curve. Cubic when
- expo_level is 0; linear when expo_level is 1.
- Returns:
- A function with a single argument (float, [-1, 1]) and output (float, [-1, 1])
- """
- def func(x):
- sgn = -1 if x < 0 else 1
- if abs(x) < dead_zone:
- return 0.
- scaled_x = sgn * (abs(x) - dead_zone) / (1. - dead_zone)
- return expo_level * scaled_x + (1. - expo_level) * pow(scaled_x, 3)
- return func
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement