title: a given point lies inside or outside a polygon
body: <p>I was trying this question and found a solution :  </p>
  
  <p>Draw a horizontal line to the right of each point and extend it to infinity</p>
  
  <blockquote>
    <p>1) Count the number of times the line intersects with polygon edges.<br>
    2) A point is inside the polygon if either count of intersections is odd or
       point lies on an edge of polygon.  If none of the conditions is true, then 
       point lies outside.
    <img src="https://i.stack.imgur.com/2KtMA.png" alt="polygon"></p>
  </blockquote>
  
  <p>But i think there is a simple solution to this :  </p>
  
  <blockquote>
    <p>for(all sides in same order)<br>
        find vector product of the 3 points (given point and end points of each side)</p>
  </blockquote>
  
  <p><code>if all products are &gt; or &lt; 0 : point lies inside polygon or on boundary<br>
  else outside</code>  </p>
  
  <p>isn't my solution better and efficient ?<br>
  is there another simpler algorithm than this ?</p>