<?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: GDL Trigonometry question in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326930#M2484</link>
    <description>&lt;P&gt;Ah...I read a doc where it was ATAN. Will try ATN instead. Thx&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 15:06:52 GMT</pubDate>
    <dc:creator>Mats_Knutsson</dc:creator>
    <dc:date>2022-01-12T15:06:52Z</dc:date>
    <item>
      <title>GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326920#M2481</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a label where i move the marker around freely through hotspots (xins and yins).&lt;/P&gt;&lt;P&gt;I don't understand how to code the line to stop at the perimeter of the circle. If I knew how ATAN works I could do this but i get an error when trying to use ATAN.&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Mats&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="gdl atan.jpg" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/18266i798E92EF9F20DC48/image-size/large?v=v2&amp;amp;px=999" role="button" title="gdl atan.jpg" alt="gdl atan.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:11:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326920#M2481</guid>
      <dc:creator>Mats_Knutsson</dc:creator>
      <dc:date>2022-01-12T13:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326921#M2482</link>
      <description>&lt;P&gt;Gegenkathete / Ankathete = TAN(alfa)&lt;/P&gt;&lt;P&gt;alfa = ATN(Gegenkathete / Ankathete)&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:46:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326921#M2482</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2022-01-12T13:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326922#M2483</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understood correctly, you would like to get the arc tangent of x, but you get an error message, correct? The function uses the argument "ATN" instead of "ATAN", see if you get the desired outcome with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:52:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326922#M2483</guid>
      <dc:creator>Zsuzsanna Bori</dc:creator>
      <dc:date>2022-01-12T13:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326930#M2484</link>
      <description>&lt;P&gt;Ah...I read a doc where it was ATAN. Will try ATN instead. Thx&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 15:06:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326930#M2484</guid>
      <dc:creator>Mats_Knutsson</dc:creator>
      <dc:date>2022-01-12T15:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326943#M2485</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/6261"&gt;@Mats_Knutsson&lt;/a&gt;&amp;nbsp;See if this works after your hotspots...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;dLine = SQR(xIns^2 + yIns^2) - rsp
IF xIns &amp;gt; 0 THEN aLine = ATN(yIns / xIns) ELSE aLine = ATN(yIns / xIns) + 180
LINE2 0,0, dline * COS(aLine), dLine * SIN(aLine)
CIRCLE2 xIns, yIns, rsp
TEXT2 xIns, yIns, stName&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Jan 2022 16:07:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326943#M2485</guid>
      <dc:creator>DGSketcher</dc:creator>
      <dc:date>2022-01-12T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326993#M2486</link>
      <description>&lt;P&gt;Gr8 thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/NPs0vPolWhs" target="_blank" rel="noopener"&gt;https://youtu.be/NPs0vPolWhs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 20:17:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/326993#M2486</guid>
      <dc:creator>Mats_Knutsson</dc:creator>
      <dc:date>2022-01-12T20:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328130#M2487</link>
      <description>&lt;P&gt;Also be extra careful not to divide by 0.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 14:30:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328130#M2487</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2022-01-25T14:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328140#M2488</link>
      <description>&lt;P&gt;Living on the edge...&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 15:24:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328140#M2488</guid>
      <dc:creator>Mats_Knutsson</dc:creator>
      <dc:date>2022-01-25T15:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328202#M2489</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/14532"&gt;@Peter Baksa&lt;/a&gt;&amp;nbsp;I did think about it &amp;amp; it only fails at exactly (?) 90 / 270 degrees. I know GDL has a problem with real numbers and zero comparison checks e.g. If A = B is replaced with ABS ( A - B ) &amp;lt; eps. What tolerance / formula would be relevant to&lt;/P&gt;&lt;P&gt;ATN ( A / B ) &amp;nbsp;to error trap when B = 0.0?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 23:15:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328202#M2489</guid>
      <dc:creator>DGSketcher</dc:creator>
      <dc:date>2022-01-25T23:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328222#M2490</link>
      <description>&lt;P&gt;Yes, there are circumstances when you can be sure the input isn't on the Y axis because some parameters forbid that, and it wouldn't be sensible architecturally. But there could be&amp;nbsp;circumstances where a draggable hotspot would be set to 90° deliberately.&lt;/P&gt;
&lt;P&gt;Maybe this is where the ATN / ATAN confusion came from: most programming languages have a non-trigonometric &lt;A href="https://en.wikipedia.org/wiki/Atan2" target="_self"&gt;ATAN2&lt;/A&gt; function taking an x and an y coordinate and returning the points' polar coordinate, handling all the cases where ATN could go wrong. GDL doesn't have such, but it can be written as a short subroutine containing a few ifs.&lt;/P&gt;
&lt;P&gt;EPS can be avoided by using &amp;gt; from the other way you would use &amp;lt;=.&lt;/P&gt;
&lt;P&gt;A working example returning degrees in range (-180...180]:&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;if abs(_x) &amp;gt; 0 then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; _atan2 = atn(_y / _x) + 90 * (1 - sgn(_x)) * (1 - 2 * (sgn(_y) &amp;lt; 0))&lt;BR /&gt;else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; _atan2 = sgn(_y * (abs(_y) &amp;gt; 0)) * 90&lt;BR /&gt;endif&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Jan 2022 08:11:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328222#M2490</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2022-01-26T08:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328250#M2491</link>
      <description>&lt;P&gt;Thank you. I will tuck that one away for future use.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 14:59:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328250#M2491</guid>
      <dc:creator>DGSketcher</dc:creator>
      <dc:date>2022-01-26T14:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Trigonometry question</title>
      <link>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328306#M2492</link>
      <description>&lt;P&gt;Great snippet!!! Could you at HQ arrange a site with clever code snippets like this?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 07:03:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/GDL-Trigonometry-question/m-p/328306#M2492</guid>
      <dc:creator>Mats_Knutsson</dc:creator>
      <dc:date>2022-01-27T07:03:46Z</dc:date>
    </item>
  </channel>
</rss>

