Hashing 2D, 3D and nD vectors

前端 未结 3 664
春和景丽
春和景丽 2020-12-07 16:48

What are good hashing functions (fast, good distribution, few collisions) for hashing 2d and 3d vectors composed of IEEE 32bit floats. I assume general 3d vectors, but algor

3条回答
  •  情歌与酒
    2020-12-07 17:25

    I have two suggestions.

    • Assume a grid cell of size l and quantize the x, y and z co-ordinates by computing ix = floor(x/l), iy = floor(y/l), and iz = floor(z/l), where ix, iy and iz are integers. Now use the hash function defined in Optimized Spatial Hashing for Collision Detection of Deformable Objects

    If you don't do the quantization, it wont be sensitive to closeness(locality).

    • Locality Sensitive Hashing has been mentioned for hashing higher dimensional vectors. Why not use them for 3d or 2d vectors as well? A variant of LSH using adapted for Eucledian distance metric (which is what we need for 2d and 3d vectors) is called Locality Sensitive Hashing using p-stable distributions. A very readable tutorial is here.

提交回复
热议问题