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.