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

ContinuousSpace.get_heading returns wrong result sometimes in toroidal space mode #943

Closed
senden9 opened this issue Oct 30, 2020 · 2 comments

Comments

@senden9
Copy link

senden9 commented Oct 30, 2020

Describe the bug
ContinuousSpace.get_heading returns wrong result when going over the middle line and toroidal space is enabled.

Expected behavior
Heading from (51, 51) to (49, 49) should return (-2, -2).

To Reproduce

import numpy as np
from mesa import space

cspace = space.ContinuousSpace(100, 100, True)
print(cspace.get_heading((51, 51), (49, 49)))

Prints (98.0, 98.0). So it goes 180 Degree in the wrong direction.

If I shift the points down I get the right results:

import numpy as np
from mesa import space

cspace = space.ContinuousSpace(100, 100, True)
print(cspace.get_heading((11, 11), (9, 9)))

Prints (-2.0, -2.0). So the correct result.

@catherinedevlin
Copy link

Confirmed that the bug is still present in v1.2.1.

@rht
Copy link
Contributor

rht commented Aug 7, 2023

Fixed by #1686.

@rht rht closed this as completed Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants