I have following dilemma I need to solve for my software:
I have a circular arc, and I do know these:
- x,y coordinates of startpoint of the arc
- x,y coordinates of endpoint of the arc
-
x,y coordinates of the center of the arc
-
The arc is drawn clockwise between startpoint and endpoint, while the last point is the middlepoint of the rotation.
What I would need is a way to calculate the coordinates of a point on the arch by knowing only the arc distance (not linear distance) from the startpoint. For example lets say the arc is in total 25 mm long, I would like to know the coordinates of a point being 11.5mm arc distance from the startpoint.
Best Answer
Let's say your given points are $A,B,M$ with $M$ the midpoint of the arc.
Find the angle between vectors $MA$ and $MB$, using dot product: $$\alpha = \cos^{-1}\frac{MA\cdot MB }{|MA|\ |MB|}$$
Find the radius $R$ of the circle; trigonometry gives $$R=\frac12 |MA| \sec\frac\alpha2$$
Find the center $C$ of the circle by going from $M$ in the direction toward $(A+B)/2$ by distance $R$. That is, $$C = M+ R\,\frac{(A+B)/2-M}{|(A+B)/2-M|}$$
The required angle of rotation is $\theta=l/R$ where $l$ is the arc distance.
Apply the rotation matrix by $\theta$ to vector $CA$ and add the result to $C$. $$ X = C + \begin{pmatrix} \cos\theta& \sin\theta \\ -\sin\theta&\cos\theta\end{pmatrix} CA $$
The point $X$ is what you are looking for.