Two robot-model axes can cross in a two-dimensional view without intersecting in three-dimensional space. If the underlying infinite lines are neither parallel nor intersecting, they are skew. Their closest separation lies along a direction perpendicular to both.
That separation is a geometric property of the declared lines. It does not by itself establish clearance between solid robot components, which also have size and shape. The following coordinates are invented mathematical inputs, with no CAD measurement, collision-check execution, or physical alignment result implied.
Declare two independent parameters
Write the first line as P(s) = p+s u and the second as Q(t) = q+t v. The points p and q identify locations, while nonzero vectors u and v identify directions. For infinite lines, s and t vary independently over all real numbers.
Paul Dawkins' authored calculus notes describe this vector line representation. MathWorld gives the distance between nonparallel lines through a scalar triple product. The original example below derives the geometric relationship and checks the closest points directly.
Set p = (0,0,0), u = (1,1,0), q = (0,1,2), and v = (1,0,1), using meters for coordinates and a consistent parameter convention. Thus P(s) = (s,s,0) and Q(t) = (t,1,2+t).
The parameters do not describe a shared time. Setting s=t would arbitrarily couple the two points and solve a different minimization problem.
A projected intersection does not satisfy every coordinate
Project onto the xy plane. The first projected line has x=y, and the second has y=1. They meet at projected point (1,1).
The first spatial line reaches that projection at s=1, giving (1,1,0). The second reaches it at t=1, giving (1,1,3). Their z coordinates differ by three meters, so the projected crossing is not a spatial intersection.
More generally, a true intersection requires one pair of parameter values to satisfy all three coordinate equations simultaneously. Matching only two coordinates discards a constraint.
Find the direction shared by all perpendicular separations
The cross product n = u cross v is (1,−1,−1), with magnitude square root three. It is perpendicular to both direction vectors, as checked by n dot u = 0 and n dot v = 0.
Let c = q−p = (0,1,2). A vector joining arbitrary points on the lines is d(s,t) = c+t v−s u. Its dot product with n is always c dot n, because both parameter-dependent terms have zero dot product with n.
Here c dot n = −3. Every joining vector therefore has the same signed component −3/square root three along the unit normal. Its magnitude cannot be less than square root three meters.
The distance formula expresses that fixed perpendicular component: D = |c dot (u cross v)| divided by |u cross v|. It gives D = square root three, approximately 1.732051 meters.
Locate points that attain the lower bound
The shortest joining vector must be perpendicular to both line directions. For this example, d(s,t) = (t−s,1−s,2+t).
Setting d dot u = 0 gives t+1−2s = 0. Setting d dot v = 0 gives 2t−s+2 = 0. Solving yields s=0 and t=−1.
The closest points are P(0) = (0,0,0) and Q(−1) = (−1,1,1). Their difference is (−1,1,1), which is exactly −n, and its length is square root three.
The explicit points attain the perpendicular-component lower bound, completing the minimum-distance argument. The three-meter vertical gap at the projected xy crossing was a different joining segment and was not minimal.
Parameter scaling must leave the line unchanged
Replace u by 5u and allow the first parameter to range over all real numbers. The geometric line remains the same; its numerical parameter merely rescales.
Both numerator and denominator in the triple-product distance formula acquire a factor of five, which cancels. Reversing either direction changes a sign but leaves the absolute distance unchanged.
This is a useful consistency check. Direction-vector magnitude is not automatically a physical length traveled, and changing a line's parameterization should not change its geometric distance from another line.
Rays and segments impose additional constraints
Now restrict the same formulas to s≥0 and t≥0, defining two rays. The infinite-line optimum t=−1 is no longer allowed.
At the boundary t=0, minimize the squared separation from q=(0,1,2) to P(s). It is s²+(1−s)²+4 = 2(s−0.5)²+4.5. The minimum occurs at s=0.5 and has distance square root 4.5, approximately 2.121320 meters.
The other ray boundary s=0 is minimized at t=0 under t≥0 and gives distance square root five. There is no admissible interior stationary point, so the smaller boundary result is the ray distance.
Restricting both parameters further to [0,1] gives two finite segments. The point s=0.5,t=0 is still allowed, so these particular segments have the same 2.121320-meter minimum.
Simply clamping t from −1 to zero while leaving s=0 would produce square root five and miss the better boundary solution. An active parameter constraint can require reoptimizing the other parameter.
Treat the parallel limit separately
For parallel directions, u cross v is zero and the nonparallel formula divides by zero. That case needs a different expression: the distance from q to the first line is |(q−p) cross u|/|u|.
Coincident parallel lines have zero distance; distinct parallel lines can have positive distance. Near-parallel numerical calculations also require care, but this article makes no claim about a library's numerical behavior. Preserve the coordinate frame, line directions, and parameter domains before interpreting a computed distance as belonging to lines, rays, or finite segments.
Sources checked October 24, 2026:
https://mathworld.wolfram.com/Line-LineDistance.html — Eric W. Weisstein, MathWorld, Line-Line Distance; triple-product distance formula read. No source example or figure reproduced, and no article-specific revision date inferred.
https://tutorial.math.lamar.edu/classes/calciii/eqnsoflines.aspx — Paul Dawkins, Lamar University Calculus III notes, Equations of Lines; vector and parametric line forms and parameter interpretation read. No source numerical example reproduced.
Illustration note: A generic robot vision scene is a concept illustration. It does not show these invented inputs, a measured robot result, or an executed software test.