triangle_udf#

iskra.geometry.distances.triangle_udf(x: Tensor, triangles: Tensor) Tensor[SOURCE]#

Unsigned distance function of a 2D point to the boundary of a triangle.

!!! tip

Internally broadcasts x, triangles together, meaning it can be used with many points and a single triangle, one point and many triangles or many points and many triangles, all by adding singleton dimensions to the batches before calling the function. Bs3 are the output batch dimensions obtained by broadcasting Bs1 and Bs2 together.

Parameters:
  • x (Tensor[Float, [Bs1, Dim]]) – Set of points.

  • triangles (Tensor[Float, [Bs2, 3, Dim]]) – Set of triangles.

Raises:

ValueError – The point and triangle must be in 2D.

Returns:

(Tensor[Float, [Bs3]]) – Unsigned distance of point to triangle boundary.