Author Topic: Two point angle return Error ?  (Read 1384 times)

0 Members and 1 Guest are viewing this topic.

hunterxyz

  • Guest
Two point angle return Error ?
« on: March 11, 2008, 09:42:10 AM »
I in calculate two point angles,
angle return to 0.0,
but angle return to 3.77208e-015,
how should solve this problem ?
Whether has the formula computation ?
Please help to explain,Thank you.

Code: [Select]
(SETQ ename (CAR (ENTSEL "\n SELECT OBJECT:")))
(SETQ n (1+ (FIX (VLAX-CURVE-GETENDPARAM ename)))
      i -1 ) ;_ setq
(REPEAT n
(SETQ ptl (CONS (VLAX-CURVE-GETPOINTATPARAM ename (SETQ i (1+ i))) ptl)) ;_ 結束

setq
) ;_ repeat
(REVERSE ptl)
(SETQ LST#PT (APPEND ptl (LIST (NTH 0 ptl))))
(SETQ LST#AG NIL)
(SETQ I -1)
(REPEAT (LENGTH ptl)
(SETQ I (1+ I))
(SETQ LST#AG (APPEND LST#AG
(LIST (ANGLE (NTH I LST#PT) (NTH (1+ I) LST#PT)))
)) ;_ SETQ
) ;_ REPEAT

[\code]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Two point angle return Error ?
« Reply #1 on: March 11, 2008, 09:55:38 AM »
Try this:

Code: [Select]
(LIST
  (if (equal 0. (setq ang (ANGLE (NTH I LST#PT) (NTH (1+ I) LST#PT))) 0.00001)
   (setq ang 0.0)
    ang
   )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.