Class UniformGrid3dImpl<V>

java.lang.Object
cz.fidentis.analyst.data.grid.impl.UniformGridImpl<javax.vecmath.Tuple3i,javax.vecmath.Tuple3d,V>
cz.fidentis.analyst.data.grid.impl.UniformGrid3dImpl<V>
Type Parameters:
V - the type of elements to be stored in the grid
All Implemented Interfaces:
UniformGrid<javax.vecmath.Tuple3d,V>, UniformGrid3d<V>

public class UniformGrid3dImpl<V> extends UniformGridImpl<javax.vecmath.Tuple3i,javax.vecmath.Tuple3d,V> implements UniformGrid3d<V>
A 3D uniform grid. This grid is infinite with given cell size (only occupied cells are remembered)
  • Constructor Details

    • UniformGrid3dImpl

      public UniformGrid3dImpl(double cellSize)
      Constructor.
      Parameters:
      cellSize - Cell size. Must be bigger that one.
    • UniformGrid3dImpl

      public UniformGrid3dImpl(double cellSize, Collection<V> objects, Function<? super V,javax.vecmath.Tuple3d> mapFunc)
      Constructor. As the mapping function, use (MeshPoint mp) -> mp.getPosition() or (Point3d p) -> p, for instance.
      Parameters:
      cellSize - Cell size. Must be bigger that one.
      objects - Objects to be stored
      mapFunc - A function that computes a 3D space location from an object
  • Method Details

    • locationToCell

      public javax.vecmath.Tuple3i locationToCell(javax.vecmath.Tuple3d loc)
      Description copied from class: UniformGridImpl
      Takes a location in space and return coordinates of the corresponding cell.
      Specified by:
      locationToCell in class UniformGridImpl<javax.vecmath.Tuple3i,javax.vecmath.Tuple3d,V>
      Parameters:
      loc - Location in space
      Returns:
      coordinates of the corresponding cell
    • getAdjacentCells

      public List<javax.vecmath.Tuple3i> getAdjacentCells(javax.vecmath.Tuple3d loc)
      Description copied from class: UniformGridImpl
      Computes the cell for given location and then all its neighbors.
      Specified by:
      getAdjacentCells in class UniformGridImpl<javax.vecmath.Tuple3i,javax.vecmath.Tuple3d,V>
      Parameters:
      loc - Location in space
      Returns:
      the cell for given location and then all its neighbors.
    • addNeighbours

      protected void addNeighbours(Collection<javax.vecmath.Tuple3i> points, javax.vecmath.Tuple3i cell)
    • neighbour

      protected javax.vecmath.Tuple3i neighbour(javax.vecmath.Tuple3i p, int x, int y, int z)