I often meet the following problem: mapping a point on the surface of a polygon in 3D coordinates to the corresponding polygon in a UV map.
To do that, the only way I've found is to:
- Triangulate the mesh (by copying the original, and use
bmesh.ops.triangulate - Then use a barycentric transform with
barycentric_transformfrommathutils.geometry
I'd like to avoid copying and triangulating the whole mesh.
My question is: how to transform on the fly the list of vertex indices associated to a polygon (which seems to be a fan) into a list of tris the same way bmesh.ops.triangulate does it (or in a coherent other way)?