<?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: angleTo() returning unexpected result for rotated vector in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700692#M351097</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Thank you, it’s really helpful! I tried suggested approach, but even with this I'm getting sign as negative only&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jun 2025 07:16:14 GMT</pubDate>
    <dc:creator>rajyalakshmi_perla</dc:creator>
    <dc:date>2025-06-27T07:16:14Z</dc:date>
    <item>
      <title>angleTo() returning unexpected result for rotated vector</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13697739#M350972</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm working with &lt;STRONG&gt;AutoCAD 2025&lt;/STRONG&gt; and the &lt;STRONG&gt;ObjectARX C++ API&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I have the following setup:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;v1({0.00000, 0.86603, 0.50000}) is the original directional vector.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;v2({-0.50000, -0.75000, -0.43301}) is v1 after being rotated using the &lt;STRONG&gt;AutoCAD ROTATE command&lt;/STRONG&gt; by &lt;STRONG&gt;150 degrees&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;v3({0.86603, -0.43301, -0.25000}) is the normal vector (axis of rotation).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm using the angleTo() function like this:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;double&lt;/SPAN&gt; angle = v1.&lt;SPAN class=""&gt;angleTo&lt;/SPAN&gt;(v2, v3); &lt;SPAN class=""&gt;// expecting ~150 degrees in radians&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the result I'm getting seems to be &lt;STRONG&gt;2π - expected angle&lt;/STRONG&gt;, i.e., ~210 degrees instead of 150 degrees (in radians).&lt;/P&gt;&lt;P&gt;Is this the expected behavior of &lt;STRONG&gt;angleTo()&lt;/STRONG&gt; in certain vector orientations, or am I missing something regarding vector direction or rotation axis?&lt;/P&gt;&lt;P&gt;Would appreciate any clarification or tips on handling this.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 13:02:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13697739#M350972</guid>
      <dc:creator>rajyalakshmi_perla</dc:creator>
      <dc:date>2025-06-25T13:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: angleTo() returning unexpected result for rotated vector</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13697819#M350974</link>
      <description>&lt;P&gt;The function apparently always returns the&amp;nbsp;smallest positive angle&amp;nbsp;between two vectors, measured&amp;nbsp;counterclockwise&amp;nbsp;around the normal vector (v3).&lt;BR /&gt;So it loops around the other side&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 13:54:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13697819#M350974</guid>
      <dc:creator>Brock_Olly</dc:creator>
      <dc:date>2025-06-25T13:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: angleTo() returning unexpected result for rotated vector</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700544#M351094</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3723257"&gt;@Brock_Olly&lt;/a&gt;&amp;nbsp; for clarifying how angleTo() works.&lt;BR /&gt;In my case though, I want to show the &lt;STRONG&gt;actual rotation angle applied&lt;/STRONG&gt; (for example, 150° CCW) in my component properties &lt;STRONG&gt;after using the built-in AutoCAD ROTATE command.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What’s the recommended way to get the actual rotation angle — matching the direction the ROTATE command applied — when I only have the original and rotated vectors and a normal vector?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 05:03:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700544#M351094</guid>
      <dc:creator>rajyalakshmi_perla</dc:creator>
      <dc:date>2025-06-27T05:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: angleTo() returning unexpected result for rotated vector</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700600#M351095</link>
      <description>&lt;P&gt;Since I only have autocad LT for the time being I cannot test it but you can try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;AcGeVector3d v1 = ...; // original vector
AcGeVector3d v2 = ...; // rotated vector
AcGeVector3d v3 = ...; // normal (rotation axis)

double angle = v1.angleTo(v2, v3); // always in [0, 2π)
double sign = v1.crossProduct(v2).dotProduct(v3) &amp;gt;= 0 ? 1.0 : -1.0;
double signedAngle = sign * angle;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 06:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700600#M351095</guid>
      <dc:creator>Brock_Olly</dc:creator>
      <dc:date>2025-06-27T06:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: angleTo() returning unexpected result for rotated vector</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700692#M351097</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you, it’s really helpful! I tried suggested approach, but even with this I'm getting sign as negative only&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 07:16:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/angleto-returning-unexpected-result-for-rotated-vector/m-p/13700692#M351097</guid>
      <dc:creator>rajyalakshmi_perla</dc:creator>
      <dc:date>2025-06-27T07:16:14Z</dc:date>
    </item>
  </channel>
</rss>

