pysdic.PointCloud.all_close#

PointCloud.all_close(other, *, rtol=1e-05, atol=1e-08, equal_nan=True, ordered=True)[source]#

Check if the points are approximately equal to the points of another point cloud (see numpy.allclose).

Point clouds with different shapes are never close.

Note

With ordered=False, both point clouds are sorted lexicographically before the comparison. Two points whose first coordinates are equal up to the tolerance may then be sorted differently, so a False result is not a proof that the point clouds differ.

Parameters:
  • other (Union[pysdic.PointCloud, ArrayLike]) – Another point cloud or an array of shape \((N_p, E)\).

  • rtol (Real, optional (default: 1e-05)) – The relative tolerance (non-negative and finite).

  • atol (Real, optional (default: 1e-08)) – The absolute tolerance (non-negative and finite).

  • equal_nan (bool, optional (default: True)) – If True, NaN values are considered equal.

  • ordered (bool, optional (default: True)) – If False, the order of the points is ignored (see the note above).

Returns:

True if all the points are close, False otherwise.

Return type:

bool

Examples

Compare a point cloud with a slightly noisy copy and with a shifted copy.

1import numpy
2from pysdic import PointCloud
3
4points = numpy.random.rand(100, 3)
5point_cloud = PointCloud(points)
6
7noise = numpy.random.normal(scale=1e-9, size=points.shape)
8print(point_cloud.all_close(PointCloud(points + noise)))  # True
9print(point_cloud.all_close(PointCloud(points + 1.0)))    # False