warp.HashGrid#

class warp.HashGrid(*args, **kwargs)[source]#

Hash-based spatial grid for accelerated neighbor queries on point data.

Supports float16, float32, and float64 precision via the dtype parameter.

__init__(dim_x, dim_y, dim_z, device=None, dtype=None)[source]#

Class representing a hash grid object for accelerated point queries.

id#

Unique identifier for this hash grid object, can be passed to kernels.

device#

Device this object lives on, all buffers must live on the same device.

dtype#

Scalar data type (float16, float32, or float64).

Note

float16 grids have limited precision (~3.3 decimal digits, max ~65504). Large coordinates or small cell widths may cause incorrect cell assignments.

Parameters:
  • dim_x (int) – Number of cells in x-axis

  • dim_y (int) – Number of cells in y-axis

  • dim_z (int) – Number of cells in z-axis

  • device – Device to create the hash grid on

  • dtype – Scalar data type for point coordinates (default: float32)

Methods

__init__(dim_x, dim_y, dim_z[, device, dtype])

Class representing a hash grid object for accelerated point queries.

build(points, radius)

Update the hash grid data structure.

reserve(num_points)

build(points, radius)[source]#

Update the hash grid data structure.

This method rebuilds the underlying datastructure and should be called any time the set of points changes.

Parameters:
  • points (warp.array) – Array of points matching the grid’s dtype (vec3h for float16, vec3/vec3f for float32, vec3d for float64)

  • radius (float) – The cell size to use for bucketing points, cells are cubes with edges of this width. For best performance the radius used to construct the grid should match closely to the radius used when performing queries.

reserve(num_points)[source]#