pysdic.PointCloud.remove_points#

PointCloud.remove_points(indices, inplace=False)[source]#

Remove points from the point cloud based on their indices.

This method returns a new PointCloud object with the points at the specified indices removed. The properties associated with the points are also updated accordingly.

See also

Parameters:
  • indices (ArrayLike) – A 1D NumPy array of integer indices representing the points to be removed from the point cloud.

  • inplace (bool, optional) – If True, modifies the current point cloud in place and returns itself. If False, returns a new PointCloud instance (default is False).

Returns:

A new PointCloud object with the points at the specified indices removed or the modified current instance if inplace is True.

Return type:

PointCloud

Raises:

ValueError – If any index is out of bounds or if the input is not a 1D array of integers.

Examples

Create a PointCloud from a random NumPy array.

1import numpy as np
2from pysdic import PointCloud
3
4# Create a random point cloud with 100 points
5random_points = np.random.rand(100, 3)  # shape (100, 3)
6point_cloud = PointCloud.from_array(random_points)

Removing points at indices 1 and 3.

1# Remove points at indices 1 and 3
2indices_to_remove = np.array([1, 3])
3new_point_cloud = point_cloud.remove_points(indices_to_remove)
4print(new_point_cloud.points)
5# Output: A NumPy array of shape (98, 3) with points at indices 1 and 3 removed