Spaces:
Runtime error
Runtime error
Download src/app/simulation/utils.py from Rolaficus/TrafficSimRL: direct link, hf CLI and curl.
- Browser
- Download file 320 Bytes
-
https://huggingface.co/spaces/Rolaficus/TrafficSimRL/resolve/main/src/app/simulation/utils.py
- Command line
-
hf download hf://spaces/Rolaficus/TrafficSimRL/src/app/simulation/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Rolaficus/TrafficSimRL/resolve/main/src/app/simulation/utils.py
320 Bytes
| import math | |
| def euclidean_dist(lat1, lon1, lat2, lon2): | |
| # Rough approximation for small distances, returning meters | |
| # 1 deg lat = 111,320m | |
| lat_mid = (lat1 + lat2) / 2.0 | |
| dx = (lon2 - lon1) * 111320.0 * math.cos(math.radians(lat_mid)) | |
| dy = (lat2 - lat1) * 111320.0 | |
| return math.sqrt(dx*dx + dy*dy) | |