added silly stuff needed for the MS implementation of hash_multimap

This commit is contained in:
Paolo Cignoni 2009-01-14 14:55:50 +00:00
parent dec8245691
commit d236258507
1 changed files with 13 additions and 0 deletions

View File

@ -50,6 +50,12 @@ namespace vcg{
// hashing function // hashing function
struct HashFunctor : public std::unary_function<Point3i, size_t> struct HashFunctor : public std::unary_function<Point3i, size_t>
{ {
enum
{ // parameters for hash table
bucket_size = 4, // 0 < bucket_size
min_buckets = 8
};
size_t operator()(const Point3i &p) const size_t operator()(const Point3i &p) const
{ {
const size_t _HASH_P0 = 73856093u; const size_t _HASH_P0 = 73856093u;
@ -58,9 +64,16 @@ namespace vcg{
return size_t(p.V(0))*_HASH_P0 ^ size_t(p.V(1))*_HASH_P1 ^ size_t(p.V(2))*_HASH_P2; return size_t(p.V(0))*_HASH_P0 ^ size_t(p.V(1))*_HASH_P1 ^ size_t(p.V(2))*_HASH_P2;
} }
bool operator()(const Point3i &s1, const Point3i &s2) const
{ // test if s1 ordered before s2
return (s1 < s2);
}
}; };
/** Spatial Hash Table /** Spatial Hash Table
Spatial Hashing as described in Spatial Hashing as described in
"Optimized Spatial Hashing for Coll ision Detection of Deformable Objects", "Optimized Spatial Hashing for Coll ision Detection of Deformable Objects",