# Determine if a point lies in a quadrangle [duplicate]

I have a quadrangle which sides consist of parts of rays, and I only know the coordinates of two points on each ray.

I need to determine if a point $$(x,y)$$ lies in such quadrangle.

In this picture, I painted the sides of the quadrangle red in case you don't understand about what quadrangle I'm talking.

## marked as duplicate by Dr. Mathva, Lee David Chung Lin, Leucippus, Cesareo, YiFanApr 17 at 13:42

• I multplied LHS of their equations as following. Can you check the sign of this product? And the logic? $$(\frac{x}{5}+ \frac{y}{3}-1).(\frac{x}{4}+ \frac{y}{-7}-1).(\frac{x}{-8}+ \frac{y}{-12}-1).(\frac{x}{5}+ \frac{y}{-2}-1)$$ – Narasimham Apr 17 at 13:51
Let $$A(x_a, y_a), B(x_b, y_b), C(x_c, y_c)$$ and $$D(x_d, y_d)$$ form the quadrilateral $$ABCD$$ with area $$S$$ and let $$P$$ be the point you've chosen.
Calculate the areas of the triangles $$\triangle PAB, \triangle PBC, \triangle PCD$$ and $$\triangle PDA$$, for instance, with the shoelace formula. Let their sum be $$S'$$. Then
\begin{align*} S'=S&\implies P\text{ lies inside }ABCD\\ S'>S&\implies P\text{ lies outside } ABCD \end{align*}