pysdic.PointCloud.concatenate#
- PointCloud.concatenate(other, inplace=False)[source]#
Concatenate the current point cloud with another
PointCloudinstance.This method combines the points from both point clouds into a new
PointCloudobject.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.nanvalues for the points from the other point cloud.- Parameters:
other (
PointCloud) – AnotherPointCloudinstance to concatenate with the current point cloud.inplace (
bool, optional) – IfTrue, modifies the current point cloud in place and returns itself. IfFalse, returns a newPointCloudinstance (default isFalse).
- Returns:
A new
PointCloudobject containing the concatenated points from both point clouds or the modified current instance ifinplaceis True- Return type:
- Raises:
ValueError – If the input is not an instance of
PointCloud. If the two point clouds have different dimensions.
Examples
Creating two
PointCloudobjects.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