The same relative coordinates give the proximity time of translating line segments as
This is a convex norm-constrained problem, rather than the linear feasibility problem for contact. One can solve it as a small second-order cone problem. If the distance between the initial line segments is at most , the answer is zero; if no feasible point exists, the threshold is never reached.
For an elementary analytic algorithm, consider the nine combinations in which each of is either free, fixed at zero or fixed at one. In each case, minimize the squared distance over the free parameters. Writing for plus the fixed endpoint contributions, and for the columns belonging to free parameters, stationarity is
If the Gram matrix is nonsingular, is affine in time. Retain only the time interval on which its entries lie in . The residual is then , and feasibility reduces to
Intersect its solution interval with and the free-parameter validity interval, and record the first point. Include the four endpoint–endpoint cases, where there are no unfixed segment parameters. Take the earliest valid candidate among all cases. The actual closest pair belongs to one of these faces of the parameter square, so this enumeration cannot miss the first approach.
The complications are the quadratic threshold equation, changes of the active closest-point feature and singular Gram matrices for parallel or degenerate segments. In a singular case, keep the affine family of minimizers and its feasibility bounds, or use the original convex problem; a pseudoinverse answer alone can fall outside the segment even when another minimizer is feasible. Constant-distance cases and tangential threshold contact must also be retained. Merely checking moving endpoints misses approaches between interior points.