(point, vertices)
return bool(wn)
Winding number test for a point in a polygon.

    Ported from the C++ version: http://geomalgorithms.com/a03-_inclusion.html

    .. note:: This implementation only works in 2-dimensional space.

    :param point: point to be tested
    :type point: list, tuple
    :param vertices: vertex points of a polygon vertices[n+1] with vertices[n] = vertices[0]
    :type vertices: list, tuple
    :return: True if the point is inside the input polygon, False otherwise
    :rtype: bool
Winding number test for a point in a polygon.
Winding number test for a point in a polygon .
def wn_poly(point, vertices):
    """ Winding number test for a point in a polygon.

    Ported from the C++ version: http://geomalgorithms.com/a03-_inclusion.html

    .. note:: This implementation only works in 2-dimensional space.

    :param point: point to be tested
    :type point: list, tuple
    :param vertices: vertex points of a polygon vertices[n+1] with vertices[n] = vertices[0]
    :type vertices: list, tuple
    :return: True if the point is inside the input polygon, False otherwise
    :rtype: bool
    """
    wn = 0  # the winding number counter

    v_size = len(vertices) - 1
    # loop through all edges of the polygon
    for i in range(v_size):  # edge from V[i] to V[i+1]
        if vertices[i][1] <= point[1]:  # start y <= P.y
            if vertices[i + 1][1] > point[1]:  # an upward crossing
                if is_left(vertices[i], vertices[i + 1], point) > 0:  # P left of edge
                    wn += 1  # have a valid up intersect
        else:  # start y > P.y (no test needed)
            if vertices[i + 1][1] <= point[1]:  # a downward crossing
                if is_left(vertices[i], vertices[i + 1], point) < 0:  # P right of edge
                    wn -= 1  # have a valid down intersect
    # return wn
    return bool(wn)
def wn_poly ( point , vertices ) : wn = 0 # the winding number counter v_size = len ( vertices ) - 1 # loop through all edges of the polygon for i in range ( v_size ) : # edge from V[i] to V[i+1] if vertices [ i ] [ 1 ] <= point [ 1 ] : # start y <= P.y if vertices [ i + 1 ] [ 1 ] > point [ 1 ] : # an upward crossing if is_left ( vertices [ i ] , vertices [ i + 1 ] , point ) > 0 : # P left of edge wn += 1 # have a valid up intersect else : # start y > P.y (no test needed) if vertices [ i + 1 ] [ 1 ] <= point [ 1 ] : # a downward crossing if is_left ( vertices [ i ] , vertices [ i + 1 ] , point ) < 0 : # P right of edge wn -= 1 # have a valid down intersect # return wn return bool ( wn )