Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the shortest segment between skew lines
ResourceFunction["SkewLineSegment"][j, k] return the shortest segment between skew lines j and k as a 3D coordinate pair. | |
Find the shortest segment between two skew lines:
| In[1]:= | ![]() |
| Out[3]= |
A list of lines may also be used:
| In[4]:= |
| Out[4]= |
Show the lines and segment:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
When two skew lines are Line objects, the returned segment is a Line:
| In[6]:= | ![]() |
| Out[7]= |
Show the skew lines and shortest connecting segment:
| In[8]:= |
| Out[8]= | ![]() |
If both lines are degenerate, the two points will be returned:
| In[9]:= | ![]() |
| Out[11]= |
If one line is degenerate, the resource function PointLineDistance is used in order to return a segment:
| In[12]:= | ![]() |
| Out[14]= |
If the lines are not skew, the resource function LineIntersection is used in order to return a degenerate segment:
| In[15]:= | ![]() |
| Out[16]= |
Find the skew line segments in a tetrahedron:
| In[17]:= | ![]() |
Repeat for two more layers:

When plotted, the secondary and tertiary skew segments seem to make a closed cycle:
| In[18]:= | ![]() |
| Out[18]= | ![]() |
Check that a cycle exists:
| In[19]:= |
| Out[19]= |
Find the skew-cycle:
| In[20]:= |
| Out[20]= |
Show the skew-cycle:
| In[21]:= |
| Out[21]= | ![]() |
Wolfram Language 12.0 (April 2019) or above
This work is licensed under a Creative Commons Attribution 4.0 International License