<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to find the shortest distance between two skew lines using vector math. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-find-the-shortest-distance-between-two-skew-lines-using/m-p/11848280#M9495</link>
    <description>&lt;P&gt;I figured it out. Just incase anyone ever needs this, here is the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void Interference(Line L1, Line L2)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;

            Vector3d U1 = L1.StartPoint.GetVectorTo(L1.EndPoint);
            Vector3d U2 = L2.StartPoint.GetVectorTo(L2.EndPoint);
 
            Vector3d N = U1.CrossProduct(U2);

            double nmag = N.Length;

            Vector3d P1P2 = L1.StartPoint.GetVectorTo(L2.StartPoint);

            Double Distance = Math.Abs(P1P2.DotProduct(N)/nmag);

            doc.Editor.WriteMessage(string.Format("\n Minimum Distance between lines {0} =",Distance.ToString()));
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Mar 2023 10:31:40 GMT</pubDate>
    <dc:creator>Yehoshua18</dc:creator>
    <dc:date>2023-03-26T10:31:40Z</dc:date>
    <item>
      <title>How to find the shortest distance between two skew lines using vector math.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-find-the-shortest-distance-between-two-skew-lines-using/m-p/11838465#M9494</link>
      <description>&lt;P&gt;Hey, I've been trying to figure out how to find the shortest distance between two skew lines. I can do it in C# without using AutoCAD vectors, but it would be much more simple if I could use them. Any idea how to make it happen? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshuaW5HNW_0-1679473479240.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1191750iA164180939CAA18D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="joshuaW5HNW_0-1679473479240.png" alt="joshuaW5HNW_0-1679473479240.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.toppr.com/guides/maths/three-dimensional-geometry/distance-between-skew-lines/" target="_blank"&gt;https://www.toppr.com/guides/maths/three-dimensional-geometry/distance-between-skew-lines/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 08:34:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-find-the-shortest-distance-between-two-skew-lines-using/m-p/11838465#M9494</guid>
      <dc:creator>Yehoshua18</dc:creator>
      <dc:date>2023-03-22T08:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the shortest distance between two skew lines using vector math.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-find-the-shortest-distance-between-two-skew-lines-using/m-p/11848280#M9495</link>
      <description>&lt;P&gt;I figured it out. Just incase anyone ever needs this, here is the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void Interference(Line L1, Line L2)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;

            Vector3d U1 = L1.StartPoint.GetVectorTo(L1.EndPoint);
            Vector3d U2 = L2.StartPoint.GetVectorTo(L2.EndPoint);
 
            Vector3d N = U1.CrossProduct(U2);

            double nmag = N.Length;

            Vector3d P1P2 = L1.StartPoint.GetVectorTo(L2.StartPoint);

            Double Distance = Math.Abs(P1P2.DotProduct(N)/nmag);

            doc.Editor.WriteMessage(string.Format("\n Minimum Distance between lines {0} =",Distance.ToString()));
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 10:31:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-find-the-shortest-distance-between-two-skew-lines-using/m-p/11848280#M9495</guid>
      <dc:creator>Yehoshua18</dc:creator>
      <dc:date>2023-03-26T10:31:40Z</dc:date>
    </item>
  </channel>
</rss>

