Two SpheroEllipses: Contact Distance Particle 1 (lower) has its center fixed at the origin Particle 2 (upper) starts at a safe distance along the z axis and is lowered until it touches particle 1 Algorithm: We define a target function sig(2,1) which equals zero if particle 1 is on the contour of 2; if 1 is inside 2, sig(2,1) < 0; if 1 is outside 2, sig(2,1) > 0. At a given distance r_AB btw centers, we let a point glide along the contour of particle 1 such that sg(r_AB)=min(sig(2,1)). This minimum is found by Golden Section Search. Varying the centers distance we find r_AB such that sg(r_AB)=0. The gradients of sig(1,2) and sig(2,1) at the contact point are drawn as blue lines; the positive long axes are black, and the centers-centers line is black/dashed. |