Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def scale(x: float, x_min: float, x_max: float, y_min: float, y_max: float) -> float:
- """Give y | (x - x_min) / (x_max - x_min) == (y - y_min) / (y_max - y_min). Also, (x_min <= x <= x_max) and (y_min <= y <= y_max). Map() in JavaScript."""
- return (x - x_min) * (y_max - y_min) / (x_max - x_min) + y_min
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement