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

Create spatial partitions #105

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

kawa-kokosowa
Copy link
Owner

@kawa-kokosowa kawa-kokosowa commented Dec 2, 2016

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.

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().
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 97.423% when pulling e0a2b5d on feature/spatial-partitions into eb047ed on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 97.423% when pulling 1800275 on feature/spatial-partitions into eb047ed on master.

@coveralls
Copy link

coveralls commented Dec 4, 2016

Coverage Status

Coverage decreased (-0.4%) to 97.432% when pulling d61007f on feature/spatial-partitions into 58f72b6 on master.

@coveralls
Copy link

coveralls commented Dec 6, 2016

Coverage Status

Coverage decreased (-1.1%) to 96.711% when pulling d65434c on feature/spatial-partitions into 58f72b6 on master.

@coveralls
Copy link

coveralls commented Dec 6, 2016

Coverage Status

Coverage decreased (-1.1%) to 96.711% when pulling 77b6e2b on feature/spatial-partitions into 58f72b6 on master.

@kawa-kokosowa
Copy link
Owner Author

kawa-kokosowa commented Dec 6, 2016

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 normal_partition_height or normal_partition_width, but I consider this a non-issue for now; the current method leaves room to be left as a heuristic.

message = 'Rect must not exceed 2x height nor width. Support soon!'
raise NotImplementedError(message)
else:
return set([
Copy link
Owner Author

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

@kawa-kokosowa
Copy link
Owner Author

you can use spatial partitions to selectively only update the contents of partitions that are on screen/nearby/etc. i should note of this.

@coveralls
Copy link

coveralls commented Dec 10, 2016

Coverage Status

Coverage decreased (-1.1%) to 96.7% when pulling 1d7e8a8 on feature/spatial-partitions into 58f72b6 on master.

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

Successfully merging this pull request may close these issues.

None yet

2 participants