pysdic.PointCloud.to_array#
- PointCloud.to_array()[source]#
Convert the point cloud to a NumPy array of shape \((N_p, E)\).
Note
The returned array is a copy of the internal points array. Modifying it will not affect the original point cloud.
See also
points()property for accessing and modifying the points of the point cloud.from_array()class method for creating a PointCloud object from a NumPy array.
- Returns:
A NumPy array of shape \((N_p, E)\) containing the coordinates of the points in the cloud.
- Return type:
Examples
Creating a
PointCloudobject 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)
Convert back to a NumPy array using the to_array method.
1# Convert the point cloud back to a NumPy array 2points_array = point_cloud.to_array() 3print(points_array) 4# Output: A NumPy array of shape (100, 3) containing the coordinates