diff --git a/octreelib/grid/grid.py b/octreelib/grid/grid.py index 2d13339..c6c63fd 100644 --- a/octreelib/grid/grid.py +++ b/octreelib/grid/grid.py @@ -67,7 +67,7 @@ def insert_points(self, pose_number: int, points: PointCloud): # Register pose self.__pose_voxel_coordinates[pose_number] = [] - # Distribute points to voxels using numpy operations + # Distribute points to voxels voxel_indices = ( (points - self._grid_config.corner) // self._grid_config.voxel_edge_length ) * self._grid_config.voxel_edge_length diff --git a/octreelib/octree/octree.py b/octreelib/octree/octree.py index a8833e7..d37ddb2 100644 --- a/octreelib/octree/octree.py +++ b/octreelib/octree/octree.py @@ -71,6 +71,8 @@ def insert_points(self, points: PointCloud): child_indices_for_points = ( (points - self.corner_min) // (self.edge_length / 2) ).astype(int) + + # Create a unique identifier for each voxel based on its indices unique_indices, inverse_indices = np.unique( child_indices_for_points, axis=0, return_inverse=True )