Hi Experts,

I would like to calculate the shortest distance(in mm) of two models using VTK based on the point coordinates of the two models. How should I proceed, Is there a sample python script to find the shortest distance?

Hi Experts,

I would like to calculate the shortest distance(in mm) of two models using VTK based on the point coordinates of the two models. How should I proceed, Is there a sample python script to find the shortest distance?

Completely different algorithms are used depending on how close the models are and if they are overlapping or not.

If models mostly overlap and there are only small differences between them then you can use ModelToModelDistance extension to compute distance between the models and then get the point corresponding to the shortest distance.

For models that do not overlap and far away from each other you may find the closest point by a few iterations of finding closest point of mesh A to a randomly selected point of mesh B, then find the closest point in mesh B to that point of mesh A, etc. You can use `FindClosestPoint`

method of any locator (vtkPointLocator, vtkCellLocator) to get closest point position on a mesh.