entente.geometry module

Functions relating to mesh geometry.

entente.geometry.compute_barycentric_coordinates(vertices_of_tris, points)[source]

Compute barycentric coordinates for the projection of a set of points to a given set of triangles specfied by their vertices.

These barycentric coordinates can refer to points outside the triangle. This happens when one of the coordinates is negative. However they can’t specify points outside the triangle’s plane. (That requires tetrahedral coordinates.)

The returned coordinates supply a linear combination which, applied to the vertices, returns the projection of the original point the plane of the triangle.

Parameters:
  • vertices_of_tris (np.arraylike) – A set of triangle vertices as kx3x3.
  • points (np.arraylike) – Coordinates of points as kx3.
Returns:

Barycentric coordinates as kx3

Return type:

np.ndarray

Note

A function with this signature probably belongs in blmath.