isSimplePolygon and isPointInside implementation with some helpers