# Point on the left or right side of a plane in 3D space

I have an alpha plane determined by 3 points in space. How can I check if another point in space is on the left side of the plane or on the right side of it?

I need a fast solution for plug-in development for a 3D application and I'm not very good at math.

http://imageshack.us/a/img221/9009/46371495.png

Thanks

-
How do you define right/left? –  chaohuang Oct 15 '12 at 10:54
for example if the plane is determined by points A(0,0,0), B(0,1,0) and C(0,0,1) then point X(-1, 0, 0) is on the left side of the plane and point Y(1,0,0) is on the right side of the plane. Sorry for being inaccurate –  John Smith Oct 15 '12 at 11:03
To distinguish the two sides of a plane, calculate a normal $n$ to it at some point $p$. Then a point $v$ is on the side where the normal points at if $(v-p) \cdot n > 0$ and on the other side if $(v-p) \cdot n < 0$. –  J. J. Oct 15 '12 at 11:05

Call the three points determining the plane $A$, $B$, $C$, and write $X$ for the new point. Form the three differences $B'=B-A$, $C'=C-A$, $X'=X-A$. Now compute the $3\times3$ determinant of the matrix whose columns (or rows, doesn't matter) are $B'$, $C'$, $X'$. The sign of the resulting determinant will be positive for $X$ on one side of the plane and negative on the other side.
I'm guessing from your comment that your planes intersect the $x$-axis in exactly one point, which determines the left and right sides.
Let $A,B,C$ be the points that determine the plane. Then the cross product $(B-A) \times (C-A)$ gives us a normal ${\bf n}$ to the plane. Now consider a test point $(x,0,0)$ where $x$ is a huge positive number. This should be on the right side of the plane. Now $((x,0,0) - A) \cdot {\bf n}$ is just the first coordinate of ${\bf n}$ times $x$ minus some constant. For large enough $x$ the sign of the dot product is then just the sign of the first coordinate of ${\bf n}$. Thus: If the sign of first coordinate of $n$ is positive, then the right side consists of the points $P$ with $(P - A) \cdot {\bf n} > 0$ and the left side consists of the points with $(P - A) \cdot {\bf n} < 0$. The inequalities are reversed if the sign of the first coordinate of $n$ is negative.