pchandler.filters.downsample

Downsampling filters for point clouds (random, voxel-grid, angle-bin).

Classes

AngleBinDownsample

Downsample a point cloud using spherical-angle binning in horizontal/vertical space.

RandomDownsampleFilter

Downsample a point cloud by uniformly random sampling a fixed ratio of points.

VoxelDownsample

Downsample a point cloud onto a regular 3D voxel grid.

class pchandler.filters.downsample.RandomDownsampleFilter

Bases: PointCloudFilter

Downsample a point cloud by uniformly random sampling a fixed ratio of points.

__init__(size, seed=None)

Downsample the point cloud by randomly sampling a fixed ratio of points.

Parameters:
  • size (PositiveFloat) – Fraction of points to keep, in the open interval (0.0, 1.0).

  • seed (int | None, optional) – Optional seed for the per-instance random generator. None (default) preserves the prior nondeterministic behaviour for no-arg callers without mutating the global numpy RNG state (TEST-07, Phase 8 D-11).

mask(pcd)

Create a mask based on a uniformly random sample of points.

Parameters:

pcd (PointCloudData) – Point cloud to be sampled.

Returns:

Boolean mask, True for sampled points.

Return type:

Vector_Bool_T

class pchandler.filters.downsample.VoxelDownsample

Bases: object

Downsample a point cloud onto a regular 3D voxel grid.

__init__(voxel_size, weighting_method='linear')

Build a voxel-grid downsampler.

Voxel centroids represent the downsampled point cloud.

Parameters:
  • voxel_size (PositiveFloat) – Edge length of each cubic voxel cell.

  • weighting_method (WeightingMethods, default="linear") – Per-point weighting strategy. One of "nearest", "constant", "linear".

sample(pcd)

Return a downsampled copy of the point cloud built from voxel centroids.

Parameters:

pcd (PointCloudData) – Source point cloud.

Returns:

New point cloud with one point per occupied voxel.

Return type:

PointCloudData

class pchandler.filters.downsample.AngleBinDownsample

Bases: object

Downsample a point cloud using spherical-angle binning in horizontal/vertical space.

__init__(angle_bin_size, weighting_method='linear')

Build a spherical-angle-bin downsampler (2D over horizontal × vertical).

Parameters:
  • angle_bin_size (PositiveFloat) – Edge length of each angular bin (same units as the spherical coordinates being binned).

  • weighting_method (WeightingMethods, default="linear") – Per-point weighting strategy. One of "nearest", "constant", "linear".

sample(pcd)

Return a downsampled copy of the point cloud built from angle-bin centroids.

Parameters:

pcd (PointCloudData) – Source point cloud.

Returns:

New point cloud with one point per occupied angular bin.

Return type:

PointCloudData