trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

Converting edges to faces

Open hkim716 opened this issue 3 years ago • 1 comments

Hi, My graph dataset does not have face information, and it has edges and x,y,z coordinates at nodes. For example, vertex_numbers = [1, 2, 3, 4, 5, 6]

edges = [
    (1, 2),
    (1, 3),
    (1, 4),
    (1, 5),

    (2, 3),
    (3, 4),
    (4, 5),
    (5, 2),

    (2, 6),
    (3, 6),
    (4, 6),
    (5, 6)
]

Assuming that I'm only using triangular mesh, how could I create faces from edges?

hkim716 avatar Jan 29 '22 10:01 hkim716

Hey, it's going to be breathtakingly slow on larger values but you could use networkx.from_edgelist + networkx.simple_cycles. There's probably a faster way to do it with scipy.csgraph or perhaps a simple lookup.

mikedh avatar Feb 03 '22 03:02 mikedh