# Thread: length of arc from 2 points in xy coords

1. ## length of arc from 2 points in xy coords

Hello folks. 1st post in this forum so hello to all.

I'm trying to create a formula to use in Excel to calculate the length of a circular arc. Sounds simple enough, but it gets more complicated (At least for me, not a maths wizard). The known data will come from a CNC machine program which would comprise of a start and end point in x,y co-ordinates, a radius and rotation direction (CW or CCW) and nothing more, that is all there is to work with. So I have start point X1,Y1 and end point X2,Y2 with radius r and I know whether CW or CCW. So IF statement is available to run a choice of formulae if beneficial dependent on whether CW or CCW. I don't what anyones Excel knowledge is here, so just a note that it wouldn't necessarily need to be an all encompassing single formula, Excel has the capability to make an initial evaluation of criteria and then choose a selection of formula to run based on the result of that initial evaluation. So there could be more than one formula if that helps, but I need a mathematical means of determining which arc length to calculate.

I have found various ways to calculate arc length, but my biggest issue is I cannot find a way for the formula to be able to decide, in all scenarios from CW or CCW, whether to calculate longer or shorter of the 2 possible arcs between the start/end point (And not forgetting if the arc is 180º, which is 3rd alternative). I can do it when X0,Y0 is at centre of arc, but I can't find a way to do it when X0Y0 is outside the arc circle.

I hope that makes sense. Any suggestions gratefully accepted as this has been twisting my head since yesterday lunchtime.
Thanks
John

2. ## OK, been trawling the net ......

... and found this. I hope it will do the job, but I don't understand the last bit (Assuming anyone understands what I've written here). ADMARSH has graciously been assisting me in typing formula in a way that might be readable.
The part I don't get (I am definitely NOT particularly good at formulas) is the $^{3/2}$ bit. It seems to indicate to me that the result of the bracketed expression then gets cubed then squared, or that's how it looks to me. But I'm probably talking rubbish. Can anyone advise, please?

$k=x'y''-y'x''/(x'^2+y'^2)^{3/2}$

3. rough paint sketch is attached ...

note that the circular center must lie on the perpendicular bisector of the segment connecting the two points in question.

also note that there are two possible positions for the circular center, O and P.

basic formula for arc length of a circular sector is $s = r\theta$, where $r$ is the radius and $\theta$ is the sector angle in radians.

to calculate $\theta$, you need to start with the distance between the two points.

$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$

using a trig ratio ... $\sin\left(\frac{\theta}{2}\right) = \frac{d}{2r}$

$\frac{\theta}{2} = \arcsin\left(\frac{d}{2r}\right)$

$\theta = 2\arcsin\left(\frac{d}{2r}\right)$

so ... circular arc length, $s = 2r\arcsin\left(\frac{d}{2r}\right)$

note that this will be the minor arc length. if you desire the major arc, then ...

$S = 2\pi r - s$

hope this helps.

4. Thanks skeeter
That might help, once I manage to digest it. My biggest issue is though, that I was hoping to be able to find a formula that, based on start/end point and rotation, would be able to determine itself whether to find major or minor arc.
As mentioned in original post, I can place both formulas in the Excel sheet, if I can find a way to mathematically determine which arc is required, Excel can then run the correct formula based on that decision. I am struggling to find a way to do that however.
Thank you for time and assistance.