<?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: Collinear 3D Points in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549059#M24354</link>
    <description>&lt;P&gt;This one is also good:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/51202034/collinear-points-c" target="_blank"&gt;https://stackoverflow.com/questions/51202034/collinear-points-c&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Aug 2021 13:56:11 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2021-08-16T13:56:11Z</dc:date>
    <item>
      <title>Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10546901#M24350</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I know there are mathematical methods to figure out if three 3D points are collinear. Since Revit gives a&amp;nbsp; method for a line to check&amp;nbsp; distance to a&amp;nbsp; point, I just wrote a function as below, assuming p2 is&amp;nbsp; always lying between p1 and&amp;nbsp; p3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public bool CollinearPoints(XYZ p1, XYZ p2, XYZ p3)
{
    Line line = Line.CreateBound(p1, p3);
    if (line.Distance(p2) == 0)
    {
        return true;
    }
    return false;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Will this be a&amp;nbsp; reliable approach?&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 14:56:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10546901#M24350</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-15T14:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10548922#M24351</link>
      <description>&lt;P&gt;Your logic is correct and it will give you what you need but only for very specific situations.&lt;BR /&gt;Like, it assumes p2 is in between p1 and p3.&lt;BR /&gt;Now if p2 was in a collinear position but it was outside then this logic won't work.&lt;BR /&gt;Also its restricted by minimum distance to make a line in revit api.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/64472"&gt;@harilalmn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 13:12:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10548922#M24351</guid>
      <dc:creator>sahin.ikbal</dc:creator>
      <dc:date>2021-08-16T13:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549025#M24352</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Check it out on Wikipedia:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://en.wikipedia.org/wiki/Collinearity" target="_blank"&gt;https://en.wikipedia.org/wiki/Collinearity&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I assume that with your method, you wish to check whether the three given points are collinear or not?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I cannot comment on your implementation and am unsure wether the built-in Revit API method will provide exactly what you need.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would suggest implementing such a check yourself; it will be more effective and you will know exactly what is going on and why.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here are some solution suggestions:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.geeksforgeeks.org/program-check-three-points-collinear/" target="_blank"&gt;https://www.geeksforgeeks.org/program-check-three-points-collinear/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Building Coder samples already includes a predicate checking for collinear lines:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;  /// &amp;lt;summary&amp;gt;
  /// Predicate returning true if two given lines are collinear
  /// &amp;lt;/summary&amp;gt;
  public static bool IsCollinear( Line a, Line b )
  {
    XYZ v = a.Direction;
    XYZ w = b.Origin - a.Origin;
    return IsParallel( v, b.Direction )
      &amp;amp;&amp;amp; IsParallel( v, w );
  }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I added a new method to check for collinear points as well:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;  /// &amp;lt;summary&amp;gt;
  /// Predicate returning true if three given points are collinear
  /// &amp;lt;/summary&amp;gt;
  public static bool AreCollinear( XYZ p, XYZ q, XYZ r )
  {
    XYZ v = q - p;
    XYZ w = r - p;
    return IsParallel( v, w );
  }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Basically, this method considers the three points as corners of a triangle, determines the vectors from one of them to the two others, and reports whether these two vectors are parallel.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please try it out and let us know whether that satisfies your requirements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the diff to the previous release:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/compare/2022.0.151.0...2022.0.151.1" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2022.0.151.0...2022.0.151.1&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 13:45:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549025#M24352</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-08-16T13:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549048#M24353</link>
      <description>&lt;P&gt;A slightly closer look at this including some views on robustness:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/4083807/collinear-points" target="_blank"&gt;https://stackoverflow.com/questions/4083807/collinear-points&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 13:53:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549048#M24353</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-08-16T13:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549059#M24354</link>
      <description>&lt;P&gt;This one is also good:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/51202034/collinear-points-c" target="_blank"&gt;https://stackoverflow.com/questions/51202034/collinear-points-c&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 13:56:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549059#M24354</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-08-16T13:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549661#M24355</link>
      <description>Yes the minimum distance is a risk, as you mentioned. I did not think about it. Thanks...!</description>
      <pubDate>Mon, 16 Aug 2021 17:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549661#M24355</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-16T17:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549689#M24356</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestions and these are&amp;nbsp; absolutely giving me better and robust solutions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, what I have been trying to do it that I have so many points and I am trying to connect these points with&amp;nbsp; walls. I will be looping through all the points. Taking three points, currentPoint (say p1), previousPoint (say p0) and nextPoint (say p2), if these three points are collinear, I wont draw a wall from p0 to p1 and skip to the next point, p2. Then I will check if p1, p2 and p3 are collinear. If not, I will draw a&amp;nbsp; straight wall from p0 to p2, rather than having two segmented walls p0-p1 and p1-p2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will definitely try out the solutions you have suggested. Thanks for the advise...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 17:51:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549689#M24356</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-16T17:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549769#M24357</link>
      <description>&lt;P&gt;Are the points you analyse sorted sequentially, or do they come in a random order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the latter case, a completely different algorithm would be much better suited, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/4557840/find-all-collinear-points-in-a-given-set" target="_blank"&gt;https://stackoverflow.com/questions/4557840/find-all-collinear-points-in-a-given-set&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 18:21:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549769#M24357</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-08-16T18:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Collinear 3D Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549882#M24358</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;These points are sequentially sorted. So that is not a problem. In fact they are points which are 'Evaluated' along a curve.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 18:57:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collinear-3d-points/m-p/10549882#M24358</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-16T18:57:57Z</dc:date>
    </item>
  </channel>
</rss>

