Does anyone know of a function to calculate the angle of an arc given 2 coordinates and the radius
or calculate the arc length
Either one would work out, but I've not been able to find such a function.
I know about axlDBGetLength but the problem is that my arc does not have it's own dbid since I'm traversing segments of shapes.
Thanks in advance
Try using these functions:
defun( DE_angleBetweenPtsWithRadius (pt2, pt1, r, cw), DE_radius2Angle(car(pt2) - car(pt1), cadr(pt2) - cadr(pt1), r) * if(cw, 1, -1))
defun( DE_circularArcLength (pt1, pt2, r), abs(0.017453 * r * DE_angleBetweenPtsWithRadius(pt1, pt2, r, nil)))
defun( DE_radius2Angle (x, y, r)
if(zerop(x) && zerop(y) then 0.0 else DE_Rad2deg(2 * asin(DE_Rndp(if(zerop(x), y / (2 * r * sin(atan2(y, x))), x / (2 * r * sin(atan2(x, y)))), 8))))
defun( DE_Rad2deg (radians) radians * 90.0 / asin(1))
defun( DE_Rndp (x, dec), "nx"), round(x * expt(10, dec)) / float(expt(10, dec)))
Note that, if you are using 16.6 you can use the new function axlRadToDeg.
Hopefully the parameters are self explanatory.
Dave Elder, Tait Communications
In reply to eDave:
That was a fast answer, thanks a lot for this.
I'll try them when I get back to work tomorrow morning :)
I'm using 16.6 and have to applause for the amount of new skill functions that I've wished for.
Brand new Excel integration, axlSetVariableFile, axlFormSetMouseActive and much more - can't wait to get started using them.
Especially the axlFormSetMouseActive where you can get the field the mouse is placed above in a form and then write help about that field to an info field.
Thanks for the tip on axlRadToDeg - I did not pay attention to that one :-)
Have a great day
This seems to work well so far, but just a minor note, theres a ) to much after "nx" :-)