tfg.geometry.representation.mesh.utils.extract_unique_edges_from_triangular_mesh

View source on GitHub

Extracts all the unique edges using the faces of a mesh.

faces A numpy.ndarray of shape [T, 3], where T is the number of triangular faces in the mesh. Each entry in this array describes the index of a vertex in the mesh.
directed_edges A boolean flag, whether to treat an edge as directed or undirected. If (i, j) is an edge in the mesh and directed_edges is True, then both (i, j) and (j, i) are returned in the list of edges. If (i, j) is an edge in the mesh and directed_edges is False, then one of (i, j) or (j, i) is returned.

A numpy.ndarray of shape [E, 2], where E is the number of edges in the mesh.

For eg: given faces = [[0, 1, 2], [0, 1, 3]], then for directed_edges = False, one valid output is [[0, 1], [0, 2], [0, 3], [1, 2], [3, 1]] for directed_edges = True, one valid output is [[0, 1], [0, 2], [0, 3], [1, 0], [1, 2], [1, 3], [2, 0], [2, 1], [3, 0], [3, 1]]

ValueError If faces is not a numpy.ndarray or if its shape is not supported.