Angle Calculation Forumla Problem?

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Toaster
Posts: 195
Joined: Mon Oct 29, 2018 5:25 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Angle Calculation Forumla Problem?

Post by Toaster »

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?
tblough
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?

Post by tblough »

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.
Post Reply