
Tridip C. answered 08/09/20
5+ years of experience in Teaching and Programming Javascript
Let your quadrilateral has 4 coordinates as V1, V2, V3, and V4. Also, let the given point be p = (x, y).
The trivial approach is to go around the polygon in order and for every pair of vertices Vi and Vi+1 (wrapping around to the first vertex if necessary), compute the quantity (x - xi)⋅(yi+1 - yi) - (xi+1 - xi)⋅(y - yi), where Vi = (xi, yi)
If these quantities all have the same sign, the point is inside the quadrilateral. The condition that they all have the same sign is the same as the condition that p is on the same side (left or right) of every edge.