I have a software that draws arches. What I need is to calculate the arch length (actual lenght of the line) by knowing only these informations:
- x,y coordinates of startpoint of the arch
- x,y coordinates of endpoint of the arch
- x,y coordinates of the center of the arch (by center I mean the center of the theoretical circle it forms, center of rotation basically)
- each arch is drawed counterclockwise
Thanks!
Let's do some simple geometry:
From the data, we can obtain directly the lengths $OA, OB, AB$. The length $\ell$ of the arch is equal to $2 O\mkern-1.5muA\,\theta$. Now $$ \tan \theta=\dfrac{OA}{OI}=\frac{OA}{\sqrt{OA^2-OI^2}}=\frac{OA}{\sqrt{OA^2-AI^2}}=\frac{OA}{\sqrt{OA^2-\cfrac{AB^2}{4}}}=\frac{2OA}{\sqrt{(2OA)^2-AB^2}}$$ so that $$\ell=\frac{(2OA)^2}{\sqrt{(2OA)^2-AB^2}}.$$
Explicitly:$$\ell=\frac{4\bigl((x_A-x_O)^2+(y_A-y_O)^2\bigr)}{4\bigl((x_A-x_O)^2+(y_A-y_O)^2\bigr)-\bigl((x_A-x_B)^2+(y_A-y_B)^2\bigr)}.$$