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

Fix bug when sampling points in a non-rectangular environment #26

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

frederikrogge
Copy link
Contributor

Hey, I figured there was a bug with how points are being sampled randomly in non-rectangular environments. First, points were sampled uniformly within the absolute distance between the extents. Therefore, if the extent in x-direction was -2, 4, only points between 0 and 6 were sampled. Secondly, it should be checked whether points are actually within the boundaries of the environment if the environment is not rectangular. However, the last if-statement checked whether it was rectangular. Both bugs should be fixed with this PR. Feel free to have a look, thanks :)

@TomGeorge1234
Copy link
Collaborator

Hey, thank you so much for catching these! You're absolutely right and the fixes are great.

I recommend you reinstall RatInABox from 1.x branch as there was another small bug regarding concave environments I caught and fixed as a result of studying yours.

Cheers!

@TomGeorge1234 TomGeorge1234 merged commit 7f2987c into RatInABox-Lab:1.x Mar 16, 2023
@frederikrogge
Copy link
Contributor Author

No problem, glad it helped.

Cheers!

SynapticSage pushed a commit to SynapticSage/RatInABox that referenced this pull request Apr 16, 2023
Fix bug when sampling points in a non-rectangular environment
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

Successfully merging this pull request may close these issues.

2 participants