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
Create spatial partitions #105
base: master
Are you sure you want to change the base?
Conversation
Add ability to generate spatial partitions for a "spatial partition grid" of arbitrary total width/height in pixels, partition width/height in pixels, and partitions wide/tall the grid is. Correctly compensates when trying to divide, say, a grid that is 31 pixels wide into 3 partitions (1px remains!). Adds scaffolding for further spatial partitioning features.
Fix for loop to iterate over the number of partitions being created, not every pixel (must have been a typo; wasn't thinking/should have proofed). Introduce doctests to collode.SpatialPartitionGrid.create_spatial_partitions().
c8f8b1f
to
d61007f
Compare
i think all that's left is to do actual group management and then it's done? it'd be nice to get it integrated into demo before merge. oh and more tests... review at any point welcome (@kcsaff?). I have a lot of stuff to clean up. Note that I should file a bug report for not having a comprehensive solution for looking up partitions for a rect which is two times the |
message = 'Rect must not exceed 2x height nor width. Support soon!' | ||
raise NotImplementedError(message) | ||
else: | ||
return set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
um... SpatialPartition
isn't a serializable object...
could just use a long string of conditions keep same complexity
you can use spatial partitions to selectively only update the contents of partitions that are on screen/nearby/etc. i should note of this. |
I'm creating this PR early, please read the commit messages.
in the future a method will handle updating positions, which will have a side effect of moving said object having its position updated (a sprite) to the sprite group of respective spatial partition.