Files
orx/orx-hash-grid

orx-hash-grid

A 2D space partitioning for points.

Usage

Create a hash grid for a given radius.

val grid = HashGrid(radius)

Check for a given query point if the grid is free, i.e. there is no point in the grid at distance less than radius away from the query point.

grid.isFree(query)

Add a point to the hash grid structure:

grid.insert(point)

Iterate over all points in the hash grid:

for (point in grid.points()) {
    // do something with point
}

Demos

DemoFilter01

source code

DemoFilter01Kt

DemoHashGrid01

source code

DemoHashGrid01Kt