Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous maps #7

Open
grmwld opened this issue Oct 27, 2015 · 1 comment
Open

Continuous maps #7

grmwld opened this issue Oct 27, 2015 · 1 comment

Comments

@grmwld
Copy link
Owner

grmwld commented Oct 27, 2015

Maps should not have hard borders, bu rather be folded in toroid.

Calculating distance becomes a bit tricky since the units on opposite sides of the map should actually be close together.

@grmwld
Copy link
Owner Author

grmwld commented Oct 27, 2015

Actually, this proves to be rather simple.
For a grid: sqrt(min(|x1 - x2|, w - |x1 - x2|)^2 + min(|y1 - y2|, h - |y1-y2|)^2)

http://stackoverflow.com/a/2123977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant