Barycentric coordinates of a point p are represented as coefficients
corresponding to the masses placed at the vertices of a
reference triangle if p is the center of mass. Barycentric coordinates are
normalized so that . These coordinates play an essential
role in computing the pixel attributes (e.g. depth, color, normals, and
texture coordinates) of a point lying on the surface of a triangle. The point
p is inside the triangle if all of its barycentric coordinates are positive.
Note
In the following, A1 to An are optional batch dimensions.
Args
triangle_vertices
A tensor of shape [A1, ..., An, 3, 2], where the last
two dimensions represents the x and y coordinates for each vertex of a
2D triangle.
pixels
A tensor of shape [A1, ..., An, N, 2], where N represents the
number of pixels, and the last dimension represents the x and y
coordinates of each pixel.
name
A name for this op that defaults to
"rasterizer_get_barycentric_coordinates".
Returns
barycentric_coordinates
A float tensor of shape [A1, ..., An, N, 3],
representing the barycentric coordinates.
valid
A boolean tensor of shape [A1, ..., An, N], which isTruewhere
pixels are inside the triangle, andFalse` otherwise.