Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given four coordinates that define the corners of an irregular quadrilateral and a point defined by its coordinates, what is the simplest way to determine if the point is within or outside of the quadrilateral?

share|cite|improve this question
Is the setting in the Cartesian plane? – hardmath Dec 15 '10 at 23:50

Take a look at this wikipedia entry, or an introductory book on computational geometry.

share|cite|improve this answer
This page has some more info: – Matthew Conroy Dec 15 '10 at 21:33

Although the links provided in some sense answer the question, the specific question can be answered without the full force of a point-in-polygon computation. I would recommend this. Compute whether each angle of your quad $(a,b,c,d)$ is convex or reflex. If one is reflex (say $a$), connect it to the opposite vertex $c$. If all are convex, choose any diagaonal; e.g., $(a,c)$. Now you have partitioned your quad into two triangles. Check if your point is in either triangle, by checking if it is left-of-or-on each of its three edges.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.