tfg.rendering.barycentrics.compute_triangle_matrices
Stay organized with collections
Save and categorize content based on your preferences.
Computes per-triangle matrices used in barycentric coordinate calculation.
tfg.rendering.barycentrics.compute_triangle_matrices(
clip_space_vertices: type_alias.TensorLike,
triangles: type_alias.TensorLike
) -> tf.Tensor
The result corresponds to the inverse matrix from equation (4) in the paper
"Triangle Scan Conversion using 2D Homogeneous Coordinates". Our matrix
inverses are not divided by the determinant, only multiplied by its sign. The
division happens in compute_barycentric_coordinates.
Args |
clip_space_vertices
|
float32 tensor with shape [vertex_count, 4] containing
vertex positions in clip space (x, y, z, w).
|
triangles
|
2-D int32 tensor with shape [triangle_count, 3]. Each triplet
contains a triangle's vertex indices in counter-clockwise order.
|
Returns |
3-D float32 tensor with shape [3, 3, triangle_count] containing per-triangle
matrices.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[null,null,["Last updated 2022-10-28 UTC."],[],[],null,["# tfg.rendering.barycentrics.compute_triangle_matrices\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/rendering/barycentrics.py#L157-L201) |\n\nComputes per-triangle matrices used in barycentric coordinate calculation. \n\n tfg.rendering.barycentrics.compute_triangle_matrices(\n clip_space_vertices: type_alias.TensorLike,\n triangles: type_alias.TensorLike\n ) -\u003e tf.Tensor\n\nThe result corresponds to the inverse matrix from equation (4) in the paper\n\"Triangle Scan Conversion using 2D Homogeneous Coordinates\". Our matrix\ninverses are not divided by the determinant, only multiplied by its sign. The\ndivision happens in compute_barycentric_coordinates.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| `clip_space_vertices` | float32 tensor with shape \\[vertex_count, 4\\] containing vertex positions in clip space (x, y, z, w). |\n| `triangles` | 2-D int32 tensor with shape \\[triangle_count, 3\\]. Each triplet contains a triangle's vertex indices in counter-clockwise order. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| 3-D float32 tensor with shape \\[3, 3, triangle_count\\] containing per-triangle matrices. ||\n\n\u003cbr /\u003e"]]