We have been given 2 points on a circle and its radius. Now I want to find out the centre point of such a circle. How can I code this efficiently without solving the quadratic equations?
Asked By : Nikunj Banka
Answered By : Yasser Zamani
$$INPUT \rightarrow P_1(x_1, y_1), P_2(x_2,y_2), r$$ $$d=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$ $$h=\sqrt{r^2-(\frac{d}2)^2}$$ $$\alpha=arcsin(\frac{y_1-y_2}{d})$$ $$x_c=\frac{x_1+x_2}2+h sin(\alpha)$$ $$y_c=\frac{y_1+y_2}2+h cos(\alpha)$$
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/19970
0 comments:
Post a Comment
Let us know your responses and feedback