Put , , and . A point on each moving segment has the form and , with . Contact is therefore equivalent toThe contact time of translating line segments is the minimum feasible . This reduces the entire continuous-motion problem to three linear equations and linear inequalities.
In three-dimensional space form the matrix . If it is nonsingular, solveusing a stable linear solver. A candidate with in the unit interval and is the only contact event and hence the earliest one; otherwise no contact occurs. Check initial intersection explicitly, so an already touching pair returns time zero.
If is singular, use a rank-revealing factorization to test consistency. Write every solution as , with columns of spanning the null space, and minimize its time coordinate subject to the box and nonnegative-time constraints. This is a small linear programming problem. It handles parallel segments, collinear overlap, a continuum of contact times and segments degenerated to points. Infeasibility means no future contact. When , the relative geometry is stationary: initially disjoint segments never meet. The first contact is the least feasible nonnegative time, not just an intersection of the two supporting lines.
The same relative coordinates give the proximity time of translating line segments asThis 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 isIf 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 toIntersect 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.
Articles by others on the same topic
There are currently no matching articles.