I would try a numerical approach using basic engineering approaches.
First set up 2 arbitrary keplerian orbits using r and v data or elemental data. If orbits of actual objects are of interest use accurate solar system data.
Second, pick arbitrary starting positions for each object.
Third, set up computation of the distance between the two objects in ...