(points, polygon, clockwise=True)
return ret
check points is in 2d convex polygons. True when point in polygon
    Args:
        points: [num_points, 2] array.
        polygon: [num_polygon, num_points_of_polygon, 2] array.
        clockwise: bool. indicate polygon is clockwise.
    Returns:
        [num_points, num_polygon] bool array.
check points is in 2d convex polygons. True when point in polygon
    Args:
        points: [num_points, 2] array.
        polygon: [num_polygon, num_points_of_polygon, 2] array.
        clockwise: bool. indicate polygon is clockwise.
    Returns:
        [num_points, num_polygon] bool array.
check points is in 2d convex polygons . True when point in polygon Args : points : [ num_points 2 ] array . polygon : [ num_polygon num_points_of_polygon 2 ] array . clockwise : bool . indicate polygon is clockwise . Returns : [ num_points num_polygon ] bool array .
def points_in_convex_polygon_jit(points, polygon, clockwise=True):
    """check points is in 2d convex polygons. True when point in polygon
    Args:
        points: [num_points, 2] array.
        polygon: [num_polygon, num_points_of_polygon, 2] array.
        clockwise: bool. indicate polygon is clockwise.
    Returns:
        [num_points, num_polygon] bool array.
    """
    # first convert polygon to directed lines
    num_points_of_polygon = polygon.shape[1]
    num_points = points.shape[0]
    num_polygons = polygon.shape[0]
    if clockwise:
        vec1 = polygon - polygon[:, [num_points_of_polygon - 1] +
                                 list(range(num_points_of_polygon - 1)), :]
    else:
        vec1 = polygon[:, [num_points_of_polygon - 1] +
                       list(range(num_points_of_polygon - 1)), :] - polygon
    # vec1: [num_polygon, num_points_of_polygon, 2]
    ret = np.zeros((num_points, num_polygons), dtype=np.bool_)
    success = True
    cross = 0.0
    for i in range(num_points):
        for j in range(num_polygons):
            success = True
            for k in range(num_points_of_polygon):
                cross = vec1[j, k, 1] * (polygon[j, k, 0] - points[i, 0])
                cross -= vec1[j, k, 0] * (polygon[j, k, 1] - points[i, 1])
                if cross >= 0:
                    success = False
                    break
            ret[i, j] = success
    return ret
def points_in_convex_polygon_jit ( points , polygon , clockwise = True ) : # first convert polygon to directed lines num_points_of_polygon = polygon . shape [ 1 ] num_points = points . shape [ 0 ] num_polygons = polygon . shape [ 0 ] if clockwise : vec1 = polygon - polygon [ : , [ num_points_of_polygon - 1 ] + list ( range ( num_points_of_polygon - 1 ) ) , : ] else : vec1 = polygon [ : , [ num_points_of_polygon - 1 ] + list ( range ( num_points_of_polygon - 1 ) ) , : ] - polygon # vec1: [num_polygon, num_points_of_polygon, 2] ret = np . zeros ( ( num_points , num_polygons ) , dtype = np . bool_ ) success = True cross = 0.0 for i in range ( num_points ) : for j in range ( num_polygons ) : success = True for k in range ( num_points_of_polygon ) : cross = vec1 [ j , k , 1 ] * ( polygon [ j , k , 0 ] - points [ i , 0 ] ) cross -= vec1 [ j , k , 0 ] * ( polygon [ j , k , 1 ] - points [ i , 1 ] ) if cross >= 0 : success = False break ret [ i , j ] = success return ret