Check if a point lies in a circle defined by three other points. I'm learning Computational Geometry, and need to check whether a point p lies inside a circle defined by a triangle(made by 3 points $a,b,c$, in counterclockwise order).
A very convenient method is to check the following determinant's sign
$D=\begin{vmatrix}
a_x & a_y & a_x^2+a_y^2 & 1 \\ 
b_x & b_y & b_x^2+b_y^2 & 1 \\ 
c_x & c_y & c_x^2+c_y^2 & 1 \\ 
p_x & p_y & p_x^2+p_y^2 & 1
\end{vmatrix}$
When $D>0$ $p$ is inside the circle defined by $a,b,c$，and outside when $D<0$ , right on the circle when $D=0$
And when $D=0$, it's clear the system of equations of D has a non-trivial solution.
That means a circle determined by that solution go through $a,b,c,p$ simultaneously.
But how can one get the inside/outside information just check the sign of $D$?
How to prove it?
 A: I get the answer finally.
I see the question about how to determine the equation of a circle defined by three points. Zaz's answer mentioned this page, which can solve my problem indirectly.
Notice that:
$D = -p_x M_{41} + p_y M_{42} - (p_x^2 +p_y^2) M_{43} + M_{44}$
and if we regard $p$ as a moving point, then $D=0$ is actually an equation of a circle:
$(p_x+\frac{1}{2}\frac{M_{41}}{M_{43}})^2+(p_y-\frac{1}{2}\frac{M_{42}}{M_{43}})^2=(\frac{1}{2}\frac{M_{41}}{M_{43}})^2+(\frac{1}{2}\frac{M_{42}}{M_{43}})^2+\frac{M_{44}}{M_{43}}$
i.e. the circle locate at $(x_0,y_0)=(\frac{1}{2}\frac{M_{41}}{M_{43}},-\frac{1}{2}\frac{M_{42}}{M_{43}})$
with radius $r_0^2=x_0^2+y_0^2+\frac{M_{44}}{M_{43}}$.
When $D>0$ the circle equation become $(x-x_0)^2+(y-y_0)^2<r_0^2$
So it's clear that if $(p_x,p_y)$ fall inside that circle, then $D>0$ and vice versa.
Note: According to Cramer's rule, $(-\frac{M_{41}}{M_{43}},\frac{M_{42}}{M_{43}},\frac{M_{44}}{M_{43}})$ is exactly the solution of the equation
$
\begin{pmatrix}
a_x & a_y & 1 \\ 
b_x & b_y & 1 \\ 
c_x & c_y & 1 
\end{pmatrix}
\boldsymbol{x}=\begin{pmatrix}a_x^2+a_y^2 \\ b_x^2+b_y^2 \\c_x^2+c_y^2\end{pmatrix}
$
And this 3 parameters perfectly define a circle pass through $a,b,c$.One can easily verify when $p$ is $a,b$ or $c$, $D=0$ by the equation above.
A: Checking the sign of the determinant is easy when you pick P with very large coordinates.
When Px and Py are super large, the dominating term in the determinant is the minor og Px^2+Py^2, so a 3 by 3 determinant whose lines are of the form (x,y,1).
Now the sign of this depends on how those 3 points are placed. It is also the sign of the vector product of AB with AC so you can relate it to some orientation.
Now P is inside the circle if the sign is opposite the sign you have when P is "at infinity"
