Convert a mesh into a dual graph :math:`(V, E)`, where :math:`V` represents the mesh faces, and :math:`E` represent the dual edges. Args: mesh (:class:`Mesh`): Input mesh. Returns: The graph :math:`(V, E)`.
(mesh)
| 30 | return vertices, np.array(edges, dtype=int) |
| 31 | |
| 32 | def mesh_to_dual_graph(mesh): |
| 33 | """ |
| 34 | Convert a mesh into a dual graph :math:`(V, E)`, where :math:`V` represents |
| 35 | the mesh faces, and :math:`E` represent the dual edges. |
| 36 | |
| 37 | Args: |
| 38 | mesh (:class:`Mesh`): Input mesh. |
| 39 | |
| 40 | Returns: |
| 41 | The graph :math:`(V, E)`. |
| 42 | """ |
| 43 | |
| 44 | mesh.enable_connectivity() |
| 45 | mesh.add_attribute("face_centroid") |
| 46 | vertices = mesh.get_face_attribute("face_centroid") |
| 47 | edges = [] |
| 48 | for fi in range(mesh.num_faces): |
| 49 | adj_faces = mesh.get_face_adjacent_faces(fi) |
| 50 | for fj in adj_faces: |
| 51 | if fj > fi: |
| 52 | edges.append((fi, fj)) |
| 53 | return vertices, np.array(edges, dtype=int) |
nothing calls this directly
no test coverage detected