(a) I have two object A and B. (They have some general curvy shape. They are objects in three dimension. They are composed of nodes with fixed coordinates). How can I found the distance on the vertical direction, or say the difference on the z-direction between the two object. I define the distance between two objects to be the shortest vertical distance between two noedes in the two objects. (Assumed that the two object don't intersect).
(b) Imagine now the object A can only move along the vertical direction, but the lateral position is fixed(x, y coordinate are fixed). This time I don't know if the two object intersect or not. I want to change the z position of object A so that the distance (as defined in (a)) between object A and B equals a setted number. Or at least slightly above it. Or you can think that I want A to be some distance above B and find the corresponding z.
Note: The object A can be generated from a mesh, While object B can be more generic. Object A and B can both just be two collections of nodes.
I would like to know if there's a good algorithm that can solve the two problems efficiently. Essentially it is just solving b. A is a definition. This problem have really bother me for a long time.