Hello,
In that case, you need to pre-process the target mesh so they closely match in space and, hence, satisfies the algorithm’s pre-condition. This is an operation called point set registration (Point-set registration - Wikipedia). Chose one that only uses rigid transformations so the points’ relative distances remain the same.
Further reading:
Doing it in VTK:
https://vtk.org/doc/nightly/html/classvtkIterativeClosestPointTransform.html
Doing it in ITK:
https://examples.itk.org/src/registration/metricsv4/registertwopointsets/documentation
Doing it in CGAL:
https://doc.cgal.org/latest/Point_set_processing_3/index.html#Point_set_processing_3Examples_registration_PointMatcher
You can do a duckduckgo search for other libraries out there with such operation implemented.
regards,
PC