World's most popular travel blog for travel bloggers.

[Solved]: Find the centre of a circle given two points lying on it and its radius

, , No Comments
Problem Detail: 

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$$ How it works $$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

 Ask a Question

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback