Considering any two cylinders, defined as: the center of their bottoms $A_i$, the radius of their bottom $R_i$, the unit vector $W_i$ of their axis direction, and the length $L_i$ of the cylinders, where $i=1,2$:
what is the necessary and sufficient condition of the intersection of the two cylinders?
I want to numerically determine (by program, e.g., Matlab or C++) whether two given cylinders intersect with each other or not. So whether the problem is numerically solvable and the uniqueness and existence of the solution become important.
Numerically, I tried to convert the problem into a linearly constrained least squares problem, but found it is hard to prove the equivalence between the intersection and the solution of the problem.
The constrained least squares problem is:
- linear constraints: the convex point sets of points between the top and bottoms of the two cylinders, this defines four linear constraints;
- find the point of which the summed squares of distance to the two cylinder axes is at minimum;
Then compare the minimum value with $\displaystyle\sum\limits_{i=1}^2 R_i^2$ to determine whether the cylinders intersect or not. -- It seems counter example can be found when there is no intersection point while the minimum is still less than the criterion.
How to find a numerically solvable (e.g., numerically convex optimization) necessary and sufficient condition so as to determine whether two cylinders intersect or not?