Hey everyone, I'm trying to write some scripts that can hit two points on the table and calculate the angle between those two points. I have most of the script worked out, but I'm having trouble with the "arc tangent" function.
I boiled down my script to a test of the "ATAN" function as you can see here:
#106=5
#108= atan 12 / 2
m225 #106 "atan is %f" #108
;Expected answer is: 1.4056
#108= atan 12 / 1
m225 #106 "atan is %f" #108
;Expected answer is: 1.4877
#108= atan 12 / .5
m225 #106 "atan is %f" #108
;Expected answer is: 1.5292
After each calculation is the answer I'd expect from doing each ATAN. The answers I actually get are off. It only seems to work the second example... Has anyone here had any experience with this?
Angle Calculation Forumla Problem?
Moderator: cnckeith
-
- Posts: 3072
- Joined: Tue Mar 22, 2016 10:03 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192 - DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Boston, MA
- Contact:
Re: Angle Calculation Forumla Problem?
Centroid's trig functions expect numbers in degrees.
Cheers,
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.