Consider having two (multiple) objects that are very close to each other. Is there any algorithm which can identify vertices of these objects that their distances are less than a tolerance and then move those vertices away from each other until the defined tolerance is reached? the figure is a 2D representation of the problem which is actually in 3d space.
Probably a nice balance between easy to implement and reasonably efficient would be to create a BVHTree for the mesh of one object, and query that with all the vertices of the other mesh using
Moving the vertices away is probably easiest if you mark the entire mesh as smooth first. That will casue the vertex normals to be in the opposite direction you want to move the vertices in. Then, for each vertex
v that you want to move, you can do
v.co -= f * v.normal, where
f is a smoothing factor. The value of
f depends on how quickly you want the vertices to move. You can use a fixed value like
0.01 to move them by 1/100th unit, or you could use a dynamic value that depends on the distance between the two meshes at that point.