pysdic.PointCloud.concatenate#

PointCloud.concatenate(other, inplace=False)[source]#

Concatenate the current point cloud with another PointCloud instance.

This method combines the points from both point clouds into a new PointCloud object.

Note

The properties in common between the two point clouds are also concatenated. If a property exists in only one of the point clouds, it will be filled with numpy.nan values for the points from the other point cloud.

Parameters:
  • other (PointCloud) – Another PointCloud instance to concatenate with the current 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 containing the concatenated points from both point clouds or the modified current instance if inplace is True

Return type:

PointCloud

Raises:

ValueError – If the input is not an instance of PointCloud. If the two point clouds have different dimensions.

Examples

Creating two PointCloud objects.

1import numpy as np
2from pysdic import PointCloud
3
4# Create two random NumPy arrays of shape (100, 3)
5random_points1 = np.random.rand(100, 3)  # shape (100, 3)
6random_points2 = np.random.rand(50, 3)   # shape (50, 3)
7
8point_cloud1 = PointCloud.from_array(random_points1)
9point_cloud2 = PointCloud.from_array(random_points2)

Concatenate the two point clouds using the concatenate() method.

1# Concatenate the two point clouds
2concatenated_point_cloud = point_cloud1.concatenate(point_cloud2)
3
4print(concatenated_point_cloud.points)
5# Output: A NumPy array of shape (150, 3) containing the concatenated coordinates