how to check whether point was inside or outside of the polygon.

I want to uses the angle to check point inside or outside, if point is inside all the angle will add up to 360, and outside was less than 360.

[ATTACH=CONFIG]158[/ATTACH]I want to know the formula for 2 point P0P1 turn into vector. so I can using[ATTACH=CONFIG]159[/ATTACH]to find angle

Usually, the way to do this for a polygon, is to triangulate and then do a check inside all triangles. You can use geometry libraries like boost::geometry for this, or find a triangulation library, and then do a point inside triangle check (for point inside triangle, you can use a barycentric method or other methods usually can be found through some googling).

For a general case, you have to consider convex and complex polygons, so that usually is a bit of a hard problem to solve.