Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: SteelWolf on November 28, 2014, 07:39:30 AM
-
Hey,
Im actually implementing all my custom probing scripts. One of them tries to calculate the orientation of a workpiece with two probing points in X and the corresponding Y values.
with tan(alpha)=deltax/deltay
first of all, mach3 has no arcsin or arccos function
so I'm using atn for the arctan function. atn(abs(deltax/deltay))
But it outputs crap and no correct angle.
Has anybody used atn before or could try a simple piece of code atn? converting this ratio, from lets say a=5 b=3, into an angle?
Thanks (:
Max
-
Hi Max,
This is what I use b = Atn(X1pos/Y1pos)*(180/(4*Atn(1))) but you have to be prepared to change the sign if moving into different quadrants.
This thread may be of interest http://www.machsupport.com/forum/index.php/topic,22932.0.html
Tweakie.
-
atn works just fine as long as you remember it's in RADIANS not degrees.
Hence Tweakie's 180/4*Atn(1) (or of course 45/atn(1)) :)
-
Brian and Art posted a formula years ago on teh Yahoo site that works well. AND there is a copy in one of the Wizards that works well and can solve for quadrants. IF I have not deleted it yet I may can find it if needed.
(;-) TP
-
Thansk for responses!
I'll try tweakies Code and report! and thanks for the link, this looks pretty interesting (another feature I have to include.. it never ends)
I should've known that its in radiant ~
Thanks!