<?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 know the orientation of a polyline in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789204#M50999</link>
    <description>&lt;P&gt;Hmmm, you made me doubt my suggestion. Let's see.&lt;/P&gt;&lt;P&gt;I'm writing this whiling analizing the cases, so I won't know my final conclusion until the end of the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The succession of polyline segments are created in 1 of 4 cases. I'm attaching the image describing those 4 cases.&lt;/P&gt;&lt;P&gt;Note: case 4 is the most comon case.&lt;/P&gt;&lt;P&gt;In all cases the point for the end of segment 1 is the same as the start of segment 2, so comparing them won't give us any information. That is why I suggested comparing the start point of segment 1 and the end point of segment 2.&lt;/P&gt;&lt;P&gt;Let's analize the cases:&lt;/P&gt;&lt;P&gt;Let's call the coordinates Seg1Start.X, Seg1Start.Y,&amp;nbsp;&lt;SPAN&gt;Seg2Start.X and Seg2Start.Y.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Case 1:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The Seg1Start.X is higher than Seg2End.X and Seg1Start.Y lower than Seg2End.Y, that means Seg1Start is to the right and below of Seg2End. Seg2 can be as long as you want. The angle can go from 0 to 180 degrees. If the angle is 0 and if Seg2End and Seg1Start are the same, the result of comparing them would be ambiguous, something that would have to be controlled. If the angle is 180. Seg2End would be left of Seg1Start, making the polyline clockwise. Anything out of that angle range would make Case1 turn into Case3. Case 1 is clockwise.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Case 2:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Anything out of angle range turns it into Case4. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case2 is counter-clockwise.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Case 3:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Anything out of angle range turns it into Case1. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case3 is counter-clockwise.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Case 4:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Anything out of angle range turns it into Case2. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case4 is clockwise.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I might be missing something (validation for weird cases). It's just a quick look at the problem.&lt;/P&gt;&lt;P&gt;Can you take a look at my post about hatches?&lt;/P&gt;&lt;P&gt;I always create threads and no one replies with ideas or advise @.@&lt;A target="_self" href="https://forums.autodesk.com/t5/NET/Block-Reference-Hatch-Deleting-loops-within-a-Hatch/td-p/3787680"&gt;My hatch post&lt;/A&gt;&lt;A target="_blank" href="https://forums.autodesk.com/t5/NET/Block-Reference-Hatch-Deleting-loops-within-a-Hatch/td-p/3787680"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Feb 2013 13:37:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-02-25T13:37:27Z</dc:date>
    <item>
      <title>How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3784606#M50993</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello. A query, any of you know any method or function that tells me the orientation of a polyline, if it is clockwise or counter-clockwise&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;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2013 23:51:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3784606#M50993</guid>
      <dc:creator>ccalvo12</dc:creator>
      <dc:date>2013-02-19T23:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3784612#M50994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search google for Signed Area, depending on convention, if the signed area is positive then you have a ccw, if not cw, and if is 0 then is a degenerated polyline (just a line).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2013 00:04:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3784612#M50994</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-02-20T00:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3785220#M50995</link>
      <description>&lt;P&gt;Try Clockwise function written by _gile from this page:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://www.acadnetwork.com/topic-250.msg447.html#msg447"&gt;http://www.acadnetwork.com/topic-250.msg447.html#msg447&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2013 16:43:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3785220#M50995</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2013-02-20T16:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3785276#M50996</link>
      <description>&lt;P&gt;Many thanks:&lt;/P&gt;&lt;P&gt;Using the formula for finding areas using determinants i was able to develop a simple function.&lt;/P&gt;&lt;P&gt;Greetings and thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Private Function SentidoPoli(ByVal pto3DPoli As Point3dCollection) As Boolean
        Dim r As Integer = pto3DPoli.Count
        Dim Matris(r, 2) As Double
        Dim rrIz As ArrayList = New ArrayList
        Dim rrDe As ArrayList = New ArrayList
        Dim sumaIz As Double = 0
        Dim sumaDe As Double = 0
        Dim area As Double = 0
        For i As Integer = 0 To r - 1
            Matris(i, 0) = pto3DPoli.Item(i).X
            Matris(i, 1) = pto3DPoli.Item(i).Y
            Matris(i, 2) = pto3DPoli.Item(i).Z
        Next
        For i As Integer = 0 To r - 2
            rrIz.Add(Matris(i, 0) * Matris(i + 1, 1))
            rrDe.Add(Matris(i + 1, 0) * Matris(i, 1))
        Next
        For i As Integer = 0 To rrIz.Count - 1
            sumaIz += rrIz.Item(i)
            sumaDe += rrDe.Item(i)
        Next
        area = 0.5 * ((sumaIz) - (sumaDe))
        If area &amp;gt; 0 Then
            Return True
        Else
            Return False
        End If
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2013 17:18:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3785276#M50996</guid>
      <dc:creator>ccalvo12</dc:creator>
      <dc:date>2013-02-20T17:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3787683#M50997</link>
      <description>&lt;P&gt;How about comparing the start and end points for only the first 2 line segments?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2013 23:01:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3787683#M50997</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-22T23:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3787834#M50998</link>
      <description>&lt;P&gt;Are you sure that's a good idea?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2013 14:29:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3787834#M50998</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2013-02-23T14:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789204#M50999</link>
      <description>&lt;P&gt;Hmmm, you made me doubt my suggestion. Let's see.&lt;/P&gt;&lt;P&gt;I'm writing this whiling analizing the cases, so I won't know my final conclusion until the end of the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The succession of polyline segments are created in 1 of 4 cases. I'm attaching the image describing those 4 cases.&lt;/P&gt;&lt;P&gt;Note: case 4 is the most comon case.&lt;/P&gt;&lt;P&gt;In all cases the point for the end of segment 1 is the same as the start of segment 2, so comparing them won't give us any information. That is why I suggested comparing the start point of segment 1 and the end point of segment 2.&lt;/P&gt;&lt;P&gt;Let's analize the cases:&lt;/P&gt;&lt;P&gt;Let's call the coordinates Seg1Start.X, Seg1Start.Y,&amp;nbsp;&lt;SPAN&gt;Seg2Start.X and Seg2Start.Y.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Case 1:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The Seg1Start.X is higher than Seg2End.X and Seg1Start.Y lower than Seg2End.Y, that means Seg1Start is to the right and below of Seg2End. Seg2 can be as long as you want. The angle can go from 0 to 180 degrees. If the angle is 0 and if Seg2End and Seg1Start are the same, the result of comparing them would be ambiguous, something that would have to be controlled. If the angle is 180. Seg2End would be left of Seg1Start, making the polyline clockwise. Anything out of that angle range would make Case1 turn into Case3. Case 1 is clockwise.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Case 2:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Anything out of angle range turns it into Case4. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case2 is counter-clockwise.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Case 3:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Anything out of angle range turns it into Case1. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case3 is counter-clockwise.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Case 4:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Anything out of angle range turns it into Case2. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case4 is clockwise.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I might be missing something (validation for weird cases). It's just a quick look at the problem.&lt;/P&gt;&lt;P&gt;Can you take a look at my post about hatches?&lt;/P&gt;&lt;P&gt;I always create threads and no one replies with ideas or advise @.@&lt;A target="_self" href="https://forums.autodesk.com/t5/NET/Block-Reference-Hatch-Deleting-loops-within-a-Hatch/td-p/3787680"&gt;My hatch post&lt;/A&gt;&lt;A target="_blank" href="https://forums.autodesk.com/t5/NET/Block-Reference-Hatch-Deleting-loops-within-a-Hatch/td-p/3787680"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 13:37:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789204#M50999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-25T13:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789258#M51000</link>
      <description>&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/47840i0ABAC87B9C840E0F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="25-02-2013 16-34-38.png" title="25-02-2013 16-34-38.png" align="middle" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First two segment are idetical...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 14:36:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789258#M51000</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2013-02-25T14:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789311#M51001</link>
      <description>&lt;P&gt;Well, we'd have to establish the criteria to clasify a polygon as clockwise or counter-clockwise.&lt;/P&gt;&lt;P&gt;I thought it depended on the order of the vertices of the polygon.&lt;/P&gt;&lt;P&gt;It's a matter that requires a bit of reading time I don't have right now.&lt;/P&gt;&lt;P&gt;You are right, that's another case. I think I was just considering&amp;nbsp;quadrilaterals XDDD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this:&amp;nbsp;&lt;A target="_blank" href="http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order"&gt;http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this:&amp;nbsp;&lt;A target="_blank" href="http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm"&gt;http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 15:20:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789311#M51001</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-25T15:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789517#M51002</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As said &lt;SPAN&gt;&lt;A target="_self" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/587082"&gt;&lt;SPAN&gt;gasty1001&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;, you can use the algebraic area (signed area) with non self crossed polylines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a little static class defining extension methods (works with arc segment polyline too).&lt;/P&gt;&lt;PRE&gt;    public static class AlgebraicArea
    {
        public static double GetArea(Point2d pt1, Point2d pt2, Point2d pt3)
        {
            return (((pt2.X - pt1.X) * (pt3.Y - pt1.Y)) -
                        ((pt3.X - pt1.X) * (pt2.Y - pt1.Y))) / 2.0;
        }

        public static double GetArea(this CircularArc2d arc)
        {
            double rad = arc.Radius;
            double ang = arc.IsClockWise ?
                arc.StartAngle - arc.EndAngle :
                arc.EndAngle - arc.StartAngle;
            return rad * rad * (ang - Math.Sin(ang)) / 2.0;
        }

        public static double GetArea(this Polyline pline)
        {
            CircularArc2d arc = new CircularArc2d();
            double area = 0.0;
            int last = pline.NumberOfVertices - 1;
            Point2d p0 = pline.GetPoint2dAt(0);

            if (pline.GetBulgeAt(0) != 0.0)
            {
                area += pline.GetArcSegment2dAt(0).GetArea();
            }
            for (int i = 1; i &amp;lt; last; i++)
            {
                area += GetArea(p0, pline.GetPoint2dAt(i), pline.GetPoint2dAt(i + 1));
                if (pline.GetBulgeAt(i) != 0.0)
                {
                    area += pline.GetArcSegment2dAt(i).GetArea(); ;
                }
            }
            if ((pline.GetBulgeAt(last) != 0.0) &amp;amp;&amp;amp; pline.Closed)
            {
                area += pline.GetArcSegment2dAt(last).GetArea();
            }
            return area;
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using example:&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("Test")]
        public void ClockwisePolyline()
        {
            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Database db = HostApplicationServices.WorkingDatabase;
            Editor ed = doc.Editor;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTableRecord btr =
                    (BlockTableRecord)db.CurrentSpaceId.GetObject(OpenMode.ForWrite);
                PromptEntityOptions peo = new PromptEntityOptions("\nSelect a polyline: ");
                peo.SetRejectMessage("Selected object is not a polyline.");
                peo.AddAllowedClass(typeof(Polyline), false);
                while (true)
                {
                    PromptEntityResult per = ed.GetEntity(peo);
                    if (per.Status != PromptStatus.OK) break; ;
                    Polyline pline = (Polyline)per.ObjectId.GetObject(OpenMode.ForRead);
                    double area = pline.GetArea();
                    Application.ShowAlertDialog(
                        string.Format("{0}\nArea = {1}", area &amp;lt; 0 ? "CW" : "CCW", area));
                }
                tr.Commit();
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:41:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789517#M51002</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-02-25T18:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789893#M51003</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nice code Gilles, just want to say that if performance is important, you don't need to divide by 2 the area, just the sign matters for the test, may be I'm wrong, but I think the same apply for arcs, it doesn't matter the area of them just the start and end point order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 23:07:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3789893#M51003</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-02-25T23:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790015#M51004</link>
      <description>&lt;P&gt;Thanks Gaston,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that, but as these extension methods may be reusable, I prefered let them return the right area.&lt;/P&gt;&lt;P&gt;About performance issue, I think (without testing) this won't be sensible until you're looping through many polylines having a great number of vertices...&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2013 05:51:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790015#M51004</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-02-26T05:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790026#M51005</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/587082"&gt;@hgasty1001&lt;/a&gt; wrote:&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;...but I think the same apply for arcs, it doesn't matter the area of them just the start and end point order...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you sure? &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/47856iD02EF5467ACD024E/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="26-02-2013 8-29-15.png" title="26-02-2013 8-29-15.png" width="313" height="192" align="middle" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2013 06:35:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790026#M51005</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2013-02-26T06:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790261#M51006</link>
      <description>&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, I was not sure, that's why I started with: "may be I'm wrong". Thanks for the counterexample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2013 13:08:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/3790261#M51006</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-02-26T13:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/5772953#M51007</link>
      <description>&lt;P&gt;Hi Gilles&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting an error with your above code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"extension method must be defined in a top level static class; AlgebraicArea is a nested class" error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is probably very easy to fix if one knows how.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2015 02:53:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/5772953#M51007</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2015-08-16T02:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/5773072#M51008</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All is said in the error message: the AlgebraicArea static class have to be a top level class instead of a nested class.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;SomeNamespace
{
    OneTopLevelClass
    {
        // ...
       SomeNestedClass
        {
            // ...
        }
    }
    AnotherToplevelClass
    {
        // ...
    }
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Aug 2015 11:49:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/5773072#M51008</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-08-16T11:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456213#M51009</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = doc.Database;&lt;BR /&gt;Editor ed = doc.Editor;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (Transaction acTrans = doc.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;foreach (ObjectId plineId in plineIds)&lt;BR /&gt;{&lt;BR /&gt;Boolean isCCW = false;&lt;BR /&gt;Polyline acPoly = (Polyline)acTrans.GetObject(plineId, OpenMode.ForRead);&lt;/P&gt;&lt;P&gt;VladUtils.qacBB.BoundingBox bbtempoPline = VladUtils.qacBB.GetBoundingBox(plineId, acTrans);&lt;BR /&gt;qNGeom.qContour points = qacPoints.GetEntPoints(plineId);&lt;BR /&gt;//no bulges&lt;BR /&gt;if (!acPoly.HasBulges)&lt;BR /&gt;{&lt;BR /&gt;isCCW = points.IsCCW(precision);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;//bulges&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;int LowestRightestPointInd = vldplUniversalPolylines.IntersectionAnalytics.GetLowestRightestPointInd(points, precision);&lt;BR /&gt;//arc arenot lower points&lt;BR /&gt;if (qNMath.IsSameNumbers(points.Contour[LowestRightestPointInd].y, bbtempoPline.minPoint.y, precision))&lt;BR /&gt;{&lt;BR /&gt;isCCW = points.IsCCW(precision);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;for(int i=0; i&amp;lt; acPoly.NumberOfVertices; i++)&lt;BR /&gt;{&lt;BR /&gt;double curbulge = acPoly.GetBulgeAt(i);&lt;BR /&gt;if (!qNMath.IsZero(curbulge, precision))&lt;BR /&gt;{&lt;BR /&gt;CircularArc2d ccc = acPoly.GetArcSegment2dAt(i);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (qNMath.IsSameNumbers(ccc.OrthoBoundBlock.BasePoint.Y, bbtempoPline.minPoint.y, precision))&lt;BR /&gt;{&lt;BR /&gt;isCCW = !ccc.IsClockWise;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;string result = (isCCW) ? "isCCW" : "NOT isCCW";&lt;BR /&gt;ed.WriteMessage("\n " + result);&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:21:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456213#M51009</guid>
      <dc:creator>VladPaly</dc:creator>
      <dc:date>2017-10-12T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: This code includes old / new moon shape with 2 vertices</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456344#M51010</link>
      <description>&lt;P&gt;public static Boolean IsCCW(Transaction acTrans, ObjectId plineId, double precision)&lt;BR /&gt;{&lt;BR /&gt;Polyline acPoly = (Polyline)acTrans.GetObject(plineId, OpenMode.ForRead);&lt;/P&gt;&lt;P&gt;VladUtils.qacBB.BoundingBox bbtempoPline = VladUtils.qacBB.GetBoundingBox(plineId, acTrans);&lt;BR /&gt;qNGeom.qContour points = qacPoints.GetEntPoints(plineId);&lt;BR /&gt;//no bulges&lt;BR /&gt;if (!acPoly.HasBulges)&lt;BR /&gt;{&lt;BR /&gt;return points.IsCCW(precision);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;//bulges&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;int LowestRightestPointInd = vldplUniversalPolylines.IntersectionAnalytics.GetLowestRightestPointInd(points, precision);&lt;BR /&gt;//arc arenot lower points&lt;BR /&gt;if (qNMath.IsSameNumbers(points.Contour[LowestRightestPointInd].y, bbtempoPline.minPoint.y, precision))&lt;BR /&gt;{&lt;BR /&gt;return points.IsCCW(precision);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;if (acPoly.NumberOfVertices == 2 &amp;amp;&amp;amp; !qNMath.IsZero(acPoly.GetBulgeAt(0), precision) &amp;amp;&amp;amp; !qNMath.IsZero(acPoly.GetBulgeAt(1), precision))&lt;BR /&gt;{&lt;BR /&gt;if(acPoly.GetArcSegment2dAt(0).Radius&amp;gt; acPoly.GetArcSegment2dAt(1).Radius)&lt;BR /&gt;{&lt;BR /&gt;return !acPoly.GetArcSegment2dAt(0).IsClockWise;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;return !acPoly.GetArcSegment2dAt(1).IsClockWise;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;for (int i = 0; i &amp;lt; acPoly.NumberOfVertices; i++)&lt;BR /&gt;{&lt;BR /&gt;double curbulge = acPoly.GetBulgeAt(i);&lt;BR /&gt;if (!qNMath.IsZero(curbulge, precision))&lt;BR /&gt;{&lt;BR /&gt;CircularArc2d ccc = acPoly.GetArcSegment2dAt(i);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (qNMath.IsSameNumbers(ccc.OrthoBoundBlock.BasePoint.Y, bbtempoPline.minPoint.y, precision))&lt;BR /&gt;{&lt;BR /&gt;return !ccc.IsClockWise;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:14:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456344#M51010</guid>
      <dc:creator>VladPaly</dc:creator>
      <dc:date>2017-10-12T21:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: This code includes old / new moon shape with 2 vertices</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456360#M51011</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1977983"&gt;@VladPaly&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paste please the formatted code:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2017-10-13_0-15-13.png" style="width: 455px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/412418i14011C1490381887/image-dimensions/455x73?v=v2" width="455" height="73" role="button" title="2017-10-13_0-15-13.png" alt="2017-10-13_0-15-13.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:17:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456360#M51011</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2017-10-12T21:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to know the orientation of a polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456453#M51012</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1977983"&gt;@VladPaly&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;snip&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VladUtils.qacBB.BoundingBox bbtempoPline = VladUtils.qacBB.GetBoundingBox(plineId, acTrans);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;snip&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What is the purpose of posting code here that calls other code that isn't included???&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:55:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-know-the-orientation-of-a-polyline/m-p/7456453#M51012</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-10-12T21:55:57Z</dc:date>
    </item>
  </channel>
</rss>

