def point_in_triangle(tri, point, i0, i1, i2):
    """ Determine if a point is in a triangle.

        Arguments:
            tri (List[Float]): The list of triangle points.
            point (List[Float]): The point to test.
            i1, i2, i3 (int): The maximum projections of the polygon's normal.

        Returns:
            in_tri (bool): If true then the point is in the triangle.
    """
    u0 = point[i1] - tri[0][i1]
    v0 = point[i2] - tri[0][i2]
    u1 = tri[1][i1] - tri[0][i1]
    v1 = tri[1][i2] - tri[0][i2]
    u2 = tri[2][i1] - tri[0][i1]
    v2 = tri[2][i2] - tri[0][i2]
    in_tri = False

    if u1 == 0.0:
        b = u0 / u2
        if (b >= 0.0) and (b <= 1.0) and (v1 != 0.0):
            a = (v0 - b*v2) / v1
            in_tri = (a >= 0.0) and ((a + b) <= 1.00001)

    else:
        b = (v0*u1 - u0*v1) / (v2*u1 - u2*v1)
        if (b >= 0.0) and (b <= 1.00001):
            a = (u0 - b*u2) / u1
            in_tri = (a >= 0.0) and ((a + b) <= 1.00001)

    return in_tri