Results 1 to 9 of 9

Thread: Angle between three points

  1. #1
    srinivasan Guest

    Angle between three points

    Hello all

    Is there any way to calculate the angle between three
    points, ///r to dimangular vertex option.

    Thanks in advance.
    Sri

  2. #2
    John Goodfellow Guest
    Maybe two calls to the Utility object's AngleFromXAxis method and some
    arithmetic.
    --
    John Goodfellow
    irtfnm
    use john at goodfellowassoc dot com


    "srinivasan" <nospam@address.withheld> wrote in message
    news:9892675.1102761075951.JavaMail.jive@jiveforum 2.autodesk.com...
    Hello all

    Is there any way to calculate the angle between three
    points, ///r to dimangular vertex option.

    Thanks in advance.
    Sri

  3. #3
    krispy Guest
    here is a lisp that will return the angle enclosed between three points, where ip is the intersecting point and pt1 and pt2 are the other points:
    Here is the code:
    Code:
    (defun enclAngle(pt1 pt2 ip / dist1 dist2 dist3)
      (setq dist1 (distance pt1 ip)
          dist2 (distance pt2 ip)
          dist3 (distance pt1 pt2)
       );setq
       ;; angle = acos((a^2 + b^2 - c^2) / (2*a*b))
       (acos (/ (- (+ (sqr dist1) (sqr dist2)) (sqr dist3)) (* 2 dist1 dist2)))
    );enclAngle
    
    
    
    ;;; acos returns the inverse of a cosine
    ;;; acos(X) = atan(-X / sqrt(-X*X+1)) + 2*atan(1)
    (defun acos(value)
       (+ 
          (atan (/	(- 0 value)	(sqrt (+ (* (- 0 value) value) 1))))
          (* 2 (atan 1))
       );+
    );acos
    
    ;;;not sure if sqr is built in
    (defun sqr(num)
       (* num num)
    );sqr

  4. #4
    devitg Guest
    There is a easy way , the old reliable CAL command

    (if (= cal nil)
    (arxload "geomcal")
    )
    ;; just to chek if GEOMCAL is loaded

    (Setq encAngle (c:cal "ang(apex,p1,p2)"));_ the angle included in p1 p2 with
    intersection point as apex


    Just a KISS: keep it simple .....Sir

    Gabriel




    "krispy" <nospam@address.withheld> escribió en el mensaje
    news:5965053.1102890756341.JavaMail.jive@jiveforum 2.autodesk.com...
    here is a lisp that will return the angle enclosed between three points,
    where ip is the intersecting point and pt1 and pt2 are the other points:
    Here is the code:
    Code:
    (defun enclAngle(pt1 pt2 ip / dist1 dist2 dist3)
    (setq dist1 (distance pt1 ip)
    dist2 (distance pt2 ip)
    dist3 (distance pt1 pt2)
    );setq
    ;; angle = acos((a^2 + b^2 - c^2) / (2*a*b))
    (acos (/ (- (+ (sqr dist1) (sqr dist2)) (sqr dist3)) (* 2 dist1 dist2)))
    );enclAngle
    
    
    
    ;;; acos returns the inverse of a cosine
    ;;; acos(X) = atan(-X / sqrt(-X*X+1)) + 2*atan(1)
    (defun acos(value)
    (+
    (atan (/ (- 0 value) (sqrt (+ (* (- 0 value) value) 1))))
    (* 2 (atan 1))
    );+
    );acos
    
    ;;;not sure if sqr is built in
    (defun sqr(num)
    (* num num)
    );sqr

  5. #5
    krispy Guest
    now where's the fun in that?
    :)

  6. #6
    krispy Guest
    i think it only fair to point out that instead of:
    (c:cal "expression")
    you can use
    (cal "expression")
    hence saving you an additional two key strokes
    lol

  7. #7
    srinivasan Guest
    Thanks all.

  8. #8
    Jorge Jimenez Guest
    This should do it (I leave the testing to you):
    The function TPA should return the angle in radians between the three points
    (cp is the common point).


    Private Function TPA(p1 As Variant, p2 As Variant, cp As Variant) As Double
    TPA = Gang(gDX(p1, cp), gDY(p1, cp)) + Gang(gDX(p2, cp), gDY(p2, cp))
    End Function

    Private Function gDX(pa As Variant, pb As Variant) As Double
    gDX = Abs(pb(0) - pa(0))
    End Function

    Private Function gDY(pa As Variant, pb As Variant) As Double
    gDY = Abs(pb(1) - pa(1))
    End Function

    Private Function Gang(DX As Double, DY As Double) As Double
    If DY = 0 Then Gang = 0 Else Gang = Atn(DY / DX)
    End Function

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    "srinivasan" <nospam@address.withheld> wrote in message
    news:9892675.1102761075951.JavaMail.jive@jiveforum 2.autodesk.com...
    Hello all

    Is there any way to calculate the angle between three
    points, ///r to dimangular vertex option.

    Thanks in advance.
    Sri

  9. #9
    Jorge Jimenez Guest
    Sorry, last function should be:

    Private Function Gang(DX As Double, DY As Double) As Double
    If DX = 0 Then Gang = 0 Else Gang = Atn(DY / DX)
    End Function

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

    "Jorge Jimenez" <unknown@nospam.com> wrote in message
    news:41bd354d_2@newsprd01...
    This should do it (I leave the testing to you):
    The function TPA should return the angle in radians between the three
    points
    (cp is the common point).


    Private Function TPA(p1 As Variant, p2 As Variant, cp As Variant) As
    Double
    TPA = Gang(gDX(p1, cp), gDY(p1, cp)) + Gang(gDX(p2, cp), gDY(p2, cp))
    End Function

    Private Function gDX(pa As Variant, pb As Variant) As Double
    gDX = Abs(pb(0) - pa(0))
    End Function

    Private Function gDY(pa As Variant, pb As Variant) As Double
    gDY = Abs(pb(1) - pa(1))
    End Function

    Private Function Gang(DX As Double, DY As Double) As Double
    If DY = 0 Then Gang = 0 Else Gang = Atn(DY / DX)
    End Function

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    "srinivasan" <nospam@address.withheld> wrote in message
    news:9892675.1102761075951.JavaMail.jive@jiveforum 2.autodesk.com...
    Hello all

    Is there any way to calculate the angle between three
    points, ///r to dimangular vertex option.

    Thanks in advance.
    Sri

Similar Threads

  1. 3rd to 1st Angle
    By Tony in forum SolidWorks
    Replies: 7
    Last Post: 04-22-2005, 09:10 AM
  2. I am confusing with angle
    By Adesu in forum Customization
    Replies: 3
    Last Post: 04-02-2005, 05:37 PM
  3. if/Cond angle
    By jvellek in forum Customization
    Replies: 36
    Last Post: 03-30-2005, 02:11 PM
  4. convert ACAD points into C3D points
    By SixFeet6 in forum VBA
    Replies: 1
    Last Post: 01-24-2005, 04:27 PM
  5. Using "Align Angle" or "Mate Angle" in assembling
    By Indyrose in forum Pro/Engineer
    Replies: 6
    Last Post: 01-20-2005, 09:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum