def invcalcbarycentric(pointuv, element_vertices):
    """
    Convert barycenteric coordinates into 3d
    https://en.wikipedia.org/wiki/Barycentric_coordinate_system
    https://math.stackexchange.com/questions/2292895/walking-on-the-surface-of-a-triangular-mesh

    :param pointuv: Point in barycenteric coordinates (u, v)
    :param element_vertices: Vertices of current element
    :return: pointuv in 3d coordinates (x, y, z)
    """
    return element_vertices[0] + pointuv[0] * (element_vertices[1] - element_vertices[0]) + pointuv[1] * (element_vertices[2] - element_vertices[0])