[Python] How Trimesh face_adjacency works

Discussão em 'Python' iniciado por Stack, Maio 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to get the two faces and two vertices that touch the edge.

    import trimesh

    mesh = trimesh.load_mesh('../demos/data/triangle_mesh.stl')

    print(len(mesh.faces),len(mesh.vertices))

    e = 10
    print(mesh.edges[e])
    f = mesh.face_adjacency[e]
    print(f)
    print(mesh.faces[f[0]])
    print(mesh.faces[f[1]])


    The output is

    200 121
    [ 7 26]
    [4 5]
    [7 8 9]
    [ 7 9 25]


    as you can see the endpoints of the edge are 7,26. But neither of the two faces contains 7 and 26. The two faces share a common edge, but its endpoints are 7,9. What is wrong with my logic?

    Continue reading...

Compartilhe esta Página