   Need help with spatial hashing function
  Unless my understanding of it is completely wrong (and it probably is) spatial hashing works like this. You basically give a hash function a point (or min and max if your using a bounding box) and it spits out a number, ie something like this:Point(1,1,1)(2,4,3)(100,2,4)Hash Returns81126The values the hash function returns are then stored in a list which is sorted in some sort of order. Values that are close in the list correspond to objects that are geographically close to one another. My problem is the hash function itself, I have no idea what one is. That is I have no idea what operation to perform on the point values to get hash values which are close in value if the given two points are close to each other.In other words:HASH_FUNCTION(1,1,1) = 3^No idea what operation to perform on (1,1,1) to get 3This guy here has a more technically correct explanation of my problem:http://webdemo.thbimage.com/image/Spatial_hash_function_4b11c6c6_0_269_14726298_news_sunsite_dk_.html   
  In our library we often need to find vertices close to a certain position. We implemented it using a spatial hashing function that sorts vertices based on their distance to a plane. That means that the hash function is a sample dot product like the plane equation. Choose the plane parameters wisely so that it does not follow common structures in your source data. For example, if your points are from a height map, they mostly lay close to the ground plane - an arbitrarily rotated plane might be a better choice here than one that is coplanar to the ground.For details, have a look at the implementation on our library: http://assimp.svn.sourceforge.net/viewvc/assimp/trunk/code/SpatialSort.cpp?revision=661&view=markup   ;  The simplest function of the form you describe is to simply divide the space into a grid with as many grid squares as you need. Deciding which square you're in is then typically a case of dividing the position by the grid size and rounding down.   