# Shortest distance between two skew lines

**URL:** <https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688>\
**Category:** Pro\
**Created:** [April 4, 2018, 2:25pm UTC](https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688 "2018-04-04T14:25:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wo3Dan](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/wo3dan/32/7450_2.png) [@Wo3Dan](https://forums.sketchup.com/u/Wo3Dan)\
**Post date:** [April 4, 2018, 2:25pm UTC](https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688/1 "2018-04-04T14:25:13Z")

</div>

Derived from this thread ([Angular Dimension Tool - #8 by slbaumgartner](https://forums.sketchup.com/t/angular-dimension-tool/64428/8) and quoted text) I was thinking whether and how SketchUp could “do the math” for me with **two skew lines** (guides) from two 3D edges to give me the location and length of the shortest distance.

> [@Angular Dimension Tool](https://forums.sketchup.com/t/angular-dimension-tool/64428/8):
>
> The final straw was that I found it is ambiguous what entities actually define the angle. As you note, is it a pair of edges? Three vertices? How does one cope when an edit causes an edge to split into two - which of them now defines the angle? What about “virtual” cases where two edges don’t actually extend to the vertex where they would have intersected? In a single situation, a person can easily answer these questions, but handling them in general algorithmically became quite complex and unreliable.

For given example (image) it seemed to do the trick quite well:

 ![image](https://global.discourse-cdn.com/sketchup/original/3X/1/f/1fd4f24b284603ee766679578d83f5a799531bcc.png)

![image](https://global.discourse-cdn.com/sketchup/original/3X/0/c/0cdc98b71903ef7e0056b571baf5e2dcae482aa2.png)

---

<div class="post-metadata">

**Author:** ![eneroth3](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/eneroth3/32/1222_2.png) [@eneroth3](https://forums.sketchup.com/u/eneroth3)\
**Post date:** [April 4, 2018, 6:56pm UTC](https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688/2 "2018-04-04T18:56:26Z")

</div>

This is already in the API. 👍

> **[Module: Geom](https://ruby.sketchup.com/Geom.html#closest_points-class_method)**
>
> The Geom module defines a number of Module methods that let you perform different geometric operations.

---

<div class="post-metadata">

**Author:** ![Wo3Dan](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/wo3dan/32/7450_2.png) [@Wo3Dan](https://forums.sketchup.com/u/Wo3Dan)\
**Post date:** [April 4, 2018, 8:50pm UTC](https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688/3 "2018-04-04T20:50:54Z")

</div>

> [@eneroth3](#):
>
> This is already in the API

😄

I’m quite happy to do this with SketchUp’s native tools that are understandable (I hope and guess) to all of us. That was my challenge.  
I’m sure that a plugin could be written to wrap this challenge into a general approach. But to be honest, I couldn’t tackle this with Ruby. You may if you wish.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sketchup/original/3X/f/2/f2a121500b085ed60806607a82720b092d800bb3.png) [@system](https://forums.sketchup.com/u/system)\
**Post date:** [July 5, 2018, 12:51pm UTC](https://forums.sketchup.com/t/shortest-distance-between-two-skew-lines/65688/4 "2018-07-05T12:51:02Z")

</div>

Closed on July 5, 2018, 12:51pm UTC

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.
