hyperplane_project#

iskra.geometry.distances.hyperplane_project(x: Tensor, origin: Tensor, normal: Tensor) Tensor[SOURCE]#

Projects points x onto (hyper)planes defined in the origin-normal form.

Can be used to project 2D points onto a line or 3D points onto a plane. Useful in tandem with iskra.edge_to_line() and iskra.triangle_to_plane().

!!! tip

Internally broadcasts x, origin, normals together, meaning it can be used to project many points onto a single hyperplane, one point onto many hyperplanes or many points to many hyperplanes, 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 in Dim-dimensional space.

  • origin (Tensor[Float, [Bs2, Dim]]) – Hyperplane origins.

  • normal (Tensor[Float, [Bs2, Dim]]) – Hyperplane normals.

Returns:

(Tensor[Float, [Bs3, Dim]]) – Closest projection of x onto its corresponding hyperplane.