Package cz.fidentis.analyst.data.grid
Interface UniformGrid<K,V>
- Type Parameters:
K
- grid's dimension, i.e.,Point2d
,Point3d
,Point4d
, etc.V
- the type of elements to be stored in the grid
- All Known Subinterfaces:
UniformGrid3d<V>
,UniformGrid4d<V>
- All Known Implementing Classes:
UniformGrid3dImpl
,UniformGrid4dImpl
,UniformGridImpl
public interface UniformGrid<K,V>
Infinite multidimensional uniform grid with the given cell size.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the grid, i.e., removes all stored values.Returns objects stored in the cell of given location in space.getAll()
Returns all objects stored in the grid.double
Returns cell size.getClosest
(K loc) Returns all objects that can be closer that the cell size.Returns non-empty cells (in random order)int
Returns number of non-empty cells.boolean
Removes an object located in the spacevoid
Stores given objects into the grid.void
Stores an object located in given 3D position in the grid.
-
Method Details
-
getCellSize
double getCellSize()Returns cell size.- Returns:
- cell size
-
numOccupiedCells
int numOccupiedCells()Returns number of non-empty cells.- Returns:
- number of non-empty cells.
-
getNonEmptyCells
Returns non-empty cells (in random order)- Returns:
- non-empty cells
-
clear
void clear()Clear the grid, i.e., removes all stored values. -
store
Stores an object located in given 3D position in the grid.- Parameters:
loc
- 3D location of the object. Must not benull
object
- Object to store.
-
store
Stores given objects into the grid. As the mapping function, use(MeshPoint mp) -> mp.getPosition()
or(Point3d p) -> p
, for instance.- Parameters:
objects
- Objects to be storedmapFunc
- A function that computes a space location from an object
-
get
Returns objects stored in the cell of given location in space.- Parameters:
loc
- location in space- Returns:
- objects stored in the cell or empty collection
-
getAll
Returns all objects stored in the grid.- Returns:
- all objects stored in the grid
-
remove
Removes an object located in the space- Parameters:
loc
- Object's location in spaceobject
- Object to be removed- Returns:
true
if the objects was found and removed,false
otherwise.
-
getClosest
Returns all objects that can be closer that the cell size.- Parameters:
loc
- location in space- Returns:
- objects that can be closer that the cell size or empty collection.
-