warp.geometry.tri_tri_adjacency#

warp.geometry.tri_tri_adjacency(
indices,
vertex_count=None,
return_neighbor_edge_indices=True,
)[source]#

Build triangle-triangle adjacency for a triangle mesh. Assumes edge-manifold with possible boundary (i.e., exactly one or two triangles per edge). Consistent triangle orientation is not required.

Parameters:
  • indices (warp.array2d[warp.int32]) – A (num_tris, 3) warp.array of triangle vertex indices (int32).

  • vertex_count (int | None) – Number of vertices in the mesh. If None, inferred as one plus the maximum vertex index. Must not be None when used in a CUDA graph capture context.

  • return_neighbor_edge_indices (bool) – If True (default), also compute and return each neighboring triangle’s local edge index for the shared edge. Pass False to skip this and build only the adjacency array, which is faster and uses less memory (use find_triangle_neighbor_edge_index to recover a single such index on demand).

Returns:

If return_neighbor_edge_indices is True, a tuple (triangle_neighbors, neighbor_edge_indices) of (num_tris, 3) int32 arrays; otherwise the single array triangle_neighbors. triangle_neighbors[t, j] is the triangle adjacent to triangle t across the edge opposite local vertex j (the edge joining local vertices (j + 1) % 3 and (j + 2) % 3), or -1 on a boundary edge. neighbor_edge_indices[t, j] is the local edge index of that shared edge within the neighboring triangle.