compas.geometry.icp_numpy(source, target, tol=0.001)[source]

Align two point clouds using the Iterative Closest Point (ICP) method.

  • source (array_like[point]) – The source data.

  • target (array_like[point]) – The target data.

  • tol (float, optional) – Tolerance for finding matches.


  • ndarray[float](N, 3) – The transformed points.

  • ndarray[float](4, 4) – The bestfit transformation matrix.


First we align the source with the target cloud using the frames resulting from a PCA of each of the clouds, simply by calculating a frame-to-frame transformation.

This initial alignment is used to establish an initial correspondence between the points of the two clouds.

Then we iteratively improve the alignment by computing successive “best-fit” transformations using SVD of the cross-covariance matrix of the two data sets. During this iterative process, we continuously update the correspondence between the point clouds by finding the closest point in the target to each of the source points.

The algorithm terminates when the alignment error is below a specified tolerance.