barycentric_coordinates#

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

Computes the barycentric coordinates of points on simplices.

This is thin dispatcher that picks one of the specialized barycentric coordinates function based on the number of corners in the simplex. Works for edges, triangles, and tetrahedra.

Parameters:
  • x (Tensor[Float, [Bs, Dim]]) – Batched points in Dim dimensions.

  • simplices (Tensor[Float, [Bs, SDim, Dim]]) – Batched simplex corners, where SDim is either 2, 3, or 4.

  • eps (float) – Numerical epsilon to use when dividing by the generalized volume of a simplex.

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

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