newton.utils.MeshAdjacency#
- class newton.utils.MeshAdjacency(indices)[source]#
Bases:
objectBuilds and stores edge adjacency information for a triangle mesh.
This class processes triangle indices to create a mapping from edges to their adjacent triangles. Each edge stores references to both adjacent triangles (if they exist) along with the opposite vertices.
- edges#
Dictionary mapping edge keys (min_vertex, max_vertex) to MeshAdjacency.Edge objects.
- indices#
The original triangle indices used to build the adjacency.
- class Edge(v0, v1, o0, o1, f0, f1)#
Bases:
objectRepresents an edge in a triangle mesh with adjacency information.
Stores the two vertices of the edge, the opposite vertices from each adjacent triangle, and the indices of those triangles. The winding order is consistent: the first triangle is reconstructed as {v0, v1, o0}, and the second triangle as {v1, v0, o1}.
For boundary edges (edges with only one adjacent triangle), o1 and f1 are set to -1.
- __init__(v0, v1, o0, o1, f0, f1)#
- __init__(indices)#
Build edge adjacency from triangle indices.
- add_edge(i0, i1, o, f)#
Add or update an edge in the adjacency structure.
If the edge already exists, updates it with the second adjacent triangle. If the edge would have more than two adjacent triangles, prints a warning (non-manifold edge).