Spaces:
Build error
Build error
Download utils/normalize_interpolate.py from dizolivemint/motion-encoder-decoder: direct link, hf CLI and curl.
- Browser
- Download file 551 Bytes
-
https://huggingface.co/spaces/dizolivemint/motion-encoder-decoder/resolve/4fa8bcb71ffa112fb0d6485e4476783a4fc60980/utils/normalize_interpolate.py
- Command line
-
hf download hf://spaces/dizolivemint/motion-encoder-decoder@4fa8bcb71ffa112fb0d6485e4476783a4fc60980/utils/normalize_interpolate.py
-
curl -L -o normalize_interpolate.py https://huggingface.co/spaces/dizolivemint/motion-encoder-decoder/resolve/4fa8bcb71ffa112fb0d6485e4476783a4fc60980/utils/normalize_interpolate.py
551 Bytes
| def normalize_interpolate(ramp_start, ramp_end, normalized): | |
| """ | |
| Get the interpolated (x, y) along a ramp given a normalized value [0.0, 1.0]. | |
| Args: | |
| ramp_start (tuple): (x0, y0) | |
| ramp_end (tuple): (x1, y1) | |
| normalized (float): 0.0 (start) to 1.0 (end) position along the ramp | |
| Returns: | |
| (x, y): interpolated pixel coordinates | |
| """ | |
| dx = ramp_end[0] - ramp_start[0] | |
| dy = ramp_end[1] - ramp_start[1] | |
| x = ramp_start[0] + normalized * dx | |
| y = ramp_start[1] + normalized * dy | |
| return (x, y) |