# Given $4$ points in the space, how do you check if an arbitrary point is within the area marked by those points?

Given $4$ arbitrary points in the space $A(x_1,y_1), B(x_2,y_2), C(x_3,y_3,), D(x_4,y_4)$, how do you check if an arbitrary point $X(x_5,y_5)$, is within the quadratic area marked by the $4$ points $A,B,C$ and $D$?

Edit:

I apologize for the mistake previously. Yes I meant quadratic area determined by 4 complanar points

• Four arbitrary points in 3-space are not in general co-planar. So the question is impossible to answer as it stands. – TonyK Jan 21 '15 at 11:33
• Assume that $A, B, C, D$ are complanar. If $ABCD$ is convex, then each diagonal divides it in two triangles, if it is not covex, then one diagonal divides $ABCD$ in two triangles. In any case, one has to check if $X$ is in one of those two triangles. – Janko Bracic Jan 21 '15 at 11:43
• Did you mean a quadratic area (2D) or perhaps a tetrahedron (3D)? – dtldarek Jan 21 '15 at 11:46
• @dtldarek It is said in the question quadratic area. – Janko Bracic Jan 21 '15 at 11:48
• @dtldarek You are right, the question is not well posed. But I guess that the question is about quadratic area determined by $4$ complanar points. I think the simplest solution is to divide the are into two triangles and the check for each of them if $X$ is in the triangle. For instance, if the triangle is $ABC$, then one has to see if $\vec{AX}$ is a convex combination of $\vec{AB}$ and $\vec{AC}$. – Janko Bracic Jan 21 '15 at 11:53