TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ItsNerfOrNothing on August 21, 2018, 09:35:05 AM

Title: verifying angles in a point list
Post by: ItsNerfOrNothing on August 21, 2018, 09:35:05 AM
I have a list of points from a poly line that runs in the 0.0 direction & the Y value may or may not change.
When verifying the angle from said point to the next point I run into where the angle is equal to [ 360.0 or (*2.0 pi) ] instead of an angle of 0.0.
Is this a quirk ? or do I just need to make a check and convert the results to 0.0 ?
It only happens when the direction is 0.0

Thanks in advance for any suggestsions or ideas.
Title: Re: verifying angles in a point list
Post by: ribarm on August 21, 2018, 09:54:03 AM
It's not a quirk, you should check and convert angle to 0.0...
Title: Re: verifying angles in a point list
Post by: ItsNerfOrNothing on August 21, 2018, 10:01:31 AM
Thanks ribarm
Title: Re: verifying angles in a point list
Post by: ronjonp on August 21, 2018, 10:14:20 AM
What does this return on your angle in question? (rem (getangle) pi)

Title: Re: verifying angles in a point list
Post by: ItsNerfOrNothing on August 21, 2018, 03:05:02 PM
I get "3.14159" = pi
Title: Re: verifying angles in a point list
Post by: ronjonp on August 21, 2018, 03:38:43 PM
I get "3.14159" = pi
Hmmm .. so your angle is not really 0.
Code: [Select]
(rem (* (+ pi pi) 0.999999999999) pi)
Title: Re: verifying angles in a point list
Post by: ItsNerfOrNothing on August 21, 2018, 03:52:16 PM
ronjonp, I see what your saying. thanks.
Just going to need to make a check with a fuzz of 1/4 of a deg.

these points are generated from a user selecting points on a drawing so I guess some inacuracies should be expected.

(if (equal (result angle) (* pi 2.0) 0.00436332)
 0.0
 (result angle)
)

Thanks again for the input, nice to see a different angle on something.
Title: Re: verifying angles in a point list
Post by: ronjonp on August 21, 2018, 04:24:45 PM
ronjonp, I see what your saying. thanks.
...
Thanks again for the input, nice to see a different angle on something.
I see what you did there ... punny :)