Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

2d collision data structure question

Started by riserbar Jan 22, 2008 at 2:47 AM 1 replies 700+ views
Original Post
riserbar
riserbar
Hi I have a large set of arbitrary rectangles and I have to test them all against a given rectangle for collision FAST. Does anyone know an efficient data structure and/or algorithm to do this? I want to avoid looping thru the whole rectangle database, so they have to be sorted somehow. Dividing the whole region into subregions would be one solution, but I wonder if there are other solutions that lead to near-logarithmic complexity.
Falken42
Falken42
Sounds like a quadtree would be perfectly suited for this.

Edit: Also found a nice Flash demo showing quadtree processing running in realtime. There are lots of other good links, just Google. :)
riserbar
riserbar
Rectangle quadtree seems to be what I needed, thanks! :)


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.