hashing - Fast access to space associated data
This modules provide tools for accessing data using its space location (not for final user).
The complexity and therefore the cost of those operations are most of the time close to the hashmap complexity O(1). It means data is found in time independently of the actual size of the mesh or whatever storage it is.
-
class
PositionMap
(cellsize, iterable=None)[source] Holds objects associated with their location. Every object can be bound to multiple locations, and each location can hold multiple objects.
cellsize
defines the box size for location hashing (the smaller it is, the bigger the memory footprint will be for non-point primitives)- Attributes defined here:
cellsize: the boxing parameter (DON’T CHANGE IT IF NON-EMPTY) dict: the hashmap from box to objects lists
-
meshcellsize
(mesh)[source] Returns a good cell size to index primitives of a mesh with a PositionMap
See implementation.
-
class
PointSet
(cellsize, iterable=None, manage=None)[source] Holds a list of points and hash them. The points are holds using indices, that allows to get the point buffer at any time, or to retrieve only a point index.
cellsize
defines the box size in which two points are considered to be the sameMethods are inspired from the builtin type set
- Attributes defined here:
points: the point buffer (READ-ONLY PURPOSE) cellsize: the boxing parameter (DON’T CHANGE IT IF NON-EMPTY). mendatory and is the distance at which you want to distinguish points dict: the hashmap from box to point indices - Build parameters:
iterable: use it to build the set by inserting elements manage: pass a list for inplace use it, only indexing will be built