<?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 Find the other point with distance and angle in LISP in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6966607#M122044</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm trying to do a function that calculates a point from a point of origin, an angle and a distance, and draw a line between the two points.&lt;BR /&gt;So, I know I can calculate the distance with something like "distance = sqrt ((x1 - x2) ^ 2 + (y1 - y2) ^ 2)" (it would not be that well in LISP, but to simplify it is something like this) or I could get the two points (pt1 and pt2) and do (list (distance pt1 pt2)) and could get in the angle this way: (list (angle pt1 pt2)). But taking into account that the information I'm going to get will only be a point, the angle and distance between that point and what I'm going to calculate, I wonder if I would have to use the "ready-made" functions I've already shown or I would have to do it some other way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm starting in LISP and really are many things in one program and I'm trying to develop the best way possible.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2017 03:38:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-23T03:38:18Z</dc:date>
    <item>
      <title>Find the other point with distance and angle in LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6966607#M122044</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm trying to do a function that calculates a point from a point of origin, an angle and a distance, and draw a line between the two points.&lt;BR /&gt;So, I know I can calculate the distance with something like "distance = sqrt ((x1 - x2) ^ 2 + (y1 - y2) ^ 2)" (it would not be that well in LISP, but to simplify it is something like this) or I could get the two points (pt1 and pt2) and do (list (distance pt1 pt2)) and could get in the angle this way: (list (angle pt1 pt2)). But taking into account that the information I'm going to get will only be a point, the angle and distance between that point and what I'm going to calculate, I wonder if I would have to use the "ready-made" functions I've already shown or I would have to do it some other way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm starting in LISP and really are many things in one program and I'm trying to develop the best way possible.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 03:38:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6966607#M122044</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-23T03:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find the other point with distance and angle in LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6966632#M122045</link>
      <description>&lt;P&gt;That is exactly what the (polar) function does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command "_.line" YourPoint &lt;STRONG&gt;(polar YourPoint YourAngle YourDistance)&lt;/STRONG&gt; "")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[do it with running object snap off, just in case].&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 04:05:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6966632#M122045</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-03-23T04:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Find the other point with distance and angle in LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6968111#M122046</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;'s answer is correct and to the point (as usual). &amp;nbsp;But you need to spend a lot of time looking at the AutoLisp help to failiarize yourself with all the possible functions you can use to solve for your end result.&lt;/P&gt;
&lt;P&gt;F'rinstance the list function creates a list; it doesn't report a list. &amp;nbsp;There's a distance function to return the numeric distance between two given points. &amp;nbsp;The idea with most AutoLisp functions is that they return a value that can be used in subsequent statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say for example that you ave two points, p1 and p2, and you want to solve for a third point, p3, that is on line with p1 and p2 and is the same distance from p2 as is p1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can do it the long way...&lt;/P&gt;
&lt;P&gt;(setq ang (angle p1 p2))&lt;/P&gt;
&lt;P&gt;(setq d (distance p1 p2))&lt;/P&gt;
&lt;P&gt;(setq p3 (polar p2 ang d))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But we can string together those calculations into a shorter form because AutoLisp is evaluated from the inside out...&lt;/P&gt;
&lt;P&gt;(setq p3 (polar p2 (angle p1 p2)(distance p1 p2)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that (distance p1 p2) is the same as (distance p2 p1),&lt;/P&gt;
&lt;P&gt;but (angle p2 p1) is 180° opposite (angle p1 p2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not meant to demean you in any way. &amp;nbsp;All of us started behind where you are now. &amp;nbsp;It's by that desire to learn that we have become more educated, and that others here contribute their time and knowledge to help us learn.&lt;/P&gt;
&lt;P&gt;It's so much fun to see newcomers asking questions so that they can learn. &amp;nbsp;I trust that one day you will be contributing clever answers.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:15:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-the-other-point-with-distance-and-angle-in-lisp/m-p/6968111#M122046</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-03-23T16:15:43Z</dc:date>
    </item>
  </channel>
</rss>

