triangle_barycentric_coordinates#

iskra.geometry.barycentric.triangle_barycentric_coordinates(x: Tensor, triangles: Tensor, eps: float = 1e-12) tuple[Tensor, Tensor][SOURCE]#

Computes the barycentric coordinates of points on triangles.

Parameters:
  • x (Tensor[Float, [Bs, Dim]]) – Batched points of dimension Dim, with Dim being either 2 or 3.

  • triangles (Tensor[Float, [Bs, 3, Dim]]) – Batched triangle corners.

  • eps (float) – Numerical epsilon to use when dividing by the area of a triangle.

Returns:
  • (Tensor[Float, [Bs, 3]]) – Barycentric coordinates.

  • ​​ (Tensor[Bool, [Bs]]) – Boolean indicating whether the barycentric weights were valid, i.e. whether the triangle was non-degenerate.