#include <perfect_spatial_hashing.h>
Classes | |
struct | Data |
Public Types | |
typedef vcg::Point3i | EntryCoordinate |
Public Member Functions | |
void | Allocate (const int entry_per_side) |
void | BuildFreeEntryList () |
void | Clear (bool delete_vectors=false) |
EntryCoordinate | DomainToHashTable (const typename UniformGrid::CellCoordinate &p) |
void | Finalize () |
Data * | GetData (const EntryCoordinate &at) const |
Data * | GetData (const int i, const int j, const int k) const |
std::list< EntryCoordinate > * | GetFreeEntryList () |
NeighboringEntryIterator | GetNeighborintEntryIterator (const EntryCoordinate &at) |
int | GetNumberOfFreeEntries () |
int | GetNumberOfNotEmptyEntries () |
int | GetSize () |
HashTable () | |
bool | IsFree (const EntryCoordinate &at) const |
Data * | operator[] (const EntryCoordinate &at) const |
void | SetEntry (const EntryCoordinate &at, std::vector< ObjectPointer > *data) |
void | ValidateEntry (EntryCoordinate &entry) |
~HashTable () | |
Protected Attributes | |
int | m_EntryPerSide |
std::list< EntryCoordinate > | m_FreeEntries |
std::vector< std::vector < std::vector< Data * > > > | m_Table |
This class substitutes the uniform grid.
Definition at line 457 of file perfect_spatial_hashing.h.
typedef vcg::Point3i vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::EntryCoordinate |
Definition at line 460 of file perfect_spatial_hashing.h.
vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::HashTable | ( | ) | [inline] |
Default constructor
Definition at line 480 of file perfect_spatial_hashing.h.
vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::~HashTable | ( | ) | [inline] |
Default destructor
Definition at line 485 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::Allocate | ( | const int | entry_per_side | ) | [inline] |
Allocates the space for the hash table; the number of entries created is entry_per_side^3.
[in] | entry_per_side | The number of entries for each size |
Definition at line 498 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::BuildFreeEntryList | ( | ) | [inline] |
Inserts each entry in the hash table in the free entry list. When this function is called, each entry in the hash table must be free.
Definition at line 539 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::Clear | ( | bool | delete_vectors = false |
) | [inline] |
Removes all the entries from the table and clears the free entry list
Definition at line 554 of file perfect_spatial_hashing.h.
EntryCoordinate vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::DomainToHashTable | ( | const typename UniformGrid::CellCoordinate & | p | ) | [inline] |
Maps a given domain entry index into a hash table index. It corresponds to the function in the original article.
Definition at line 581 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::Finalize | ( | ) | [inline] |
Definition at line 518 of file perfect_spatial_hashing.h.
Data* vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetData | ( | const EntryCoordinate & | at | ) | const [inline] |
Definition at line 651 of file perfect_spatial_hashing.h.
Data* vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetData | ( | const int | i, | |
const int | j, | |||
const int | k | |||
) | const [inline] |
Return the pointer to the data stored in the hash table at the given position.
[in] | at | The position of the hash table where looks for the data. |
Definition at line 650 of file perfect_spatial_hashing.h.
std::list< EntryCoordinate >* vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetFreeEntryList | ( | ) | [inline] |
Returns the reference to the free entry list
Definition at line 575 of file perfect_spatial_hashing.h.
NeighboringEntryIterator vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetNeighborintEntryIterator | ( | const EntryCoordinate & | at | ) | [inline] |
Definition at line 491 of file perfect_spatial_hashing.h.
int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetNumberOfFreeEntries | ( | ) | [inline] |
Returns the number of free entries.
Definition at line 631 of file perfect_spatial_hashing.h.
int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetNumberOfNotEmptyEntries | ( | ) | [inline] |
Return the number of entries where there is some domain data.
Definition at line 639 of file perfect_spatial_hashing.h.
int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::GetSize | ( | ) | [inline] |
Definition at line 626 of file perfect_spatial_hashing.h.
bool vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::IsFree | ( | const EntryCoordinate & | at | ) | const [inline] |
Check if a given position in the hash table is free.
[in] | at | The position of the hash table to check. |
Definition at line 619 of file perfect_spatial_hashing.h.
Data* vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::operator[] | ( | const EntryCoordinate & | at | ) | const [inline] |
Definition at line 652 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::SetEntry | ( | const EntryCoordinate & | at, | |
std::vector< ObjectPointer > * | data | |||
) | [inline] |
Inserts a new element in the hash table at the given position.
[in] | at | The position in the hash table where the new element will be created |
[in] | data | The set of the domain elements contained in this entry |
Definition at line 595 of file perfect_spatial_hashing.h.
void vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::ValidateEntry | ( | EntryCoordinate & | entry | ) | [inline] |
Given a hash table entry, this function modifies its coordinates in order to guarantee that they are in the valid range. Call this function before accessing the hash table.
[in,out] | entry | The entry whose coordinates have to be checked. |
Definition at line 607 of file perfect_spatial_hashing.h.
int vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::m_EntryPerSide [protected] |
The number of entries for each side of the hash-table.
Definition at line 655 of file perfect_spatial_hashing.h.
std::list< EntryCoordinate > vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::m_FreeEntries [protected] |
The list containing the free entries.
Definition at line 657 of file perfect_spatial_hashing.h.
std::vector< std::vector< std::vector < Data* > > > vcg::PerfectSpatialHashing< OBJECT_TYPE, SCALAR_TYPE >::HashTable::m_Table [protected] |
The table.
Definition at line 656 of file perfect_spatial_hashing.h.