Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Hash Table

Moderators: larsivi kris

Posted: 03/20/07 17:05:59

Does anyone have experience with the HashMap??

I found a good research paper that explores real-time rigid body collision detection utilizing spacial hashing.

The idea is to create a hash table where each bucket is associated with a unique grid cell and where the index of any object occupying that grid cell is stored. I have a few questions on how to setup the hash buckets, associate them with the grid cells, and then add index values (keys) to those buckets.

Here is a link to the paper: http://www.cs.ucf.edu/~hastings/papers/hashing-sim.zip

Any help would be greatly appreciated!

Thanks, Mason

Author Message

Posted: 03/21/07 19:53:15

Ok, I think I may have found a solution.

I'm going to create my Hash Table using the HashSet? container. I'm sure I could have used another container, but since my primary interest is speed I'll go with the HashSet?.

I'll initialize the Hast Table like so:

        alias HashSet!(int) objectSet;
	objectSet[NUM_OBJECTS] set;

	for(int i = 0; i < NUM_OBJECTS; i++)
		set[i] = new objectSet;

The set[] array represents the entire Hash Table. Each individual bucket in the table is created with a HashSet? container, and I'll use a Hash Function to determine which bucket I place my object index into.

Is this a sound method or foolish? My primary interest is execution time. Since my goal is to use this for rigid body collision detection I need my Hash Table to be as efficient as possible.

Comments?

Thanks, Mason