# How to know location of a point?

I have a circle formed with three given points. How can i know whether another given point is inside the circle formed by previous three points. Is it determinant i need to calculate? Then what are the cases i need to handle?

-

Let $A(x_1,y_1),~~B(x_2,y_2),~~C(x_3,y_3)$ are three arbitrary points in $\mathbb R^2$. If you want to check if another give point is in the circle or out of it, you should have the equation of the circle. Let's assume its equation is of the form: $$(x-a)^2+(y-b)^2=r^2$$ and our forth point is $(x_4,y_4)$. If $(x_4-a)^2+(y_4-b)^2>r^2$ so the point is out of the circle and if $<r$ it is in the circle. Can you find the equation of the circle?

-
Yeah i am writing down the equation to form a equation given three points. Is there any simple way to get it? – u2425 Feb 25 '13 at 7:46
@u2425: Actually for the equation I don't know any fast way. I know just a classic way to find the equation but it takes time and paper. ;-) – Babak S. Feb 25 '13 at 7:51
+1 The classic way is the way to go! Good Day to you, Babak!! – amWhy Feb 25 '13 at 14:01

After you calculated the center and the radius you just check if the norm of the center - the point is lower than the radius. If yes, than the poin is in the circle, if not he isn't.

-
yeah that a kind of brute force method, but i remember of using determinant but not sure of it. I am designing algorithm which needs some best ways of computation. So cant go with that. @Dominic – u2425 Feb 25 '13 at 7:29
Than ask for it. You tupels $(x,y)$ or? else you don't have a circle – Dominic Michaelis Feb 25 '13 at 7:34

If you really would like to use determinants to find this, there are ways. For e.g. check http://www-ma2.upc.es/%7Egeoc/circumferenciaEN.pdf for a method (you would first need to know how to check the orientation of the triangle formed by three points, which is yet another determinant).

-

Use complex numbers to represent the points. If $z_1,z_2,z_3$ are the points determining the circle, going around the circle in counterclockwise order, and $z$ is the point you wish to locate as inside or outside of the circle, calculate the cross-ratio $$r = \frac{(z_1-z_3)(z_2-z)}{(z_1-z)(z_2-z_4)}.$$ Then $z$ is inside the circle through $z_1,z_2,z_3$ if $r$ has positive imaginary part, while $z$ is outside the circle if $r$ has negative imaginary part. A point $z$ which is on the circle will give an $r$ with imaginary part $0$.

Of course this assumes $z_1,z_2,z_3$ are not on a line, which your program would presumably ensure. And before calculating $r$, one should check whether $z$ happens to be equal to one of $z_1,z_2,z_3$; the answer is already known in that case, so no loss there.

If it's a problem determining which order is counterclockwise, one out is to first use $z=1000$ or some value known to be outside the circle, and then keep track of the imaginary parts of $r$ calculated using both the sought point $z$ and using $1000$ for $z$. Those $z$ giving the oppositely signed imaginary part will then be inside the circle, etc.

-