pysdic.PointCloud.from_array#
- classmethod PointCloud.from_array(points, copy=False, properties=None)[source]#
Create a
PointCloudobject from a NumPy array of shape \((N_p, E)\).See also
to_array()method for converting the point cloud back to a NumPy array.
- Parameters:
points (ArrayLike) – A NumPy array of shape \((N_p, E)\) representing the coordinates of the points.
copy (
bool, optional) – IfTrue, a copy of the input array is made. Default isFalse. If the given object is not a typenumpy.float64array, a copy will be made regardless of this parameter.properties (Optional[Dict[
str, ArrayLike]], optional) – A dictionary of additional properties to associate with the point cloud. Keys are property names, and values are NumPy arrays of property data of shape \((N_p, A)\)
- Returns:
A
PointCloudobject containing the provided points.- Return type:
- Raises:
TypeError – If the input points is not a NumPy array. If the properties is not a dictionary.
ValueError – If the input array does not have the correct shape \((N_p, E)\). If the properties arrays do not have the correct shape \((N_p, A)\).
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)
Now,
point_cloudis aPointCloudobject containing the points from the NumPy array.