warp.geometry.delaunay_edge_flip#

warp.geometry.delaunay_edge_flip(
positions,
indices,
ref_positions=None,
max_passes=1000,
area_epsilon=0.0,
ref_area_epsilon=1.0e-10,
)[source]#

Flip non-Delaunay interior edges in place until all are Delaunay or max passes is reached.

The triangulation is modified in place: indices is updated with the flipped connectivity while positions is left unchanged. Each iteration flips an independent set of edges in parallel; CUDA graph capture is supported.

Parameters:
  • positions (warp.array[warp.vec2f]) – A (vertex_count,) warp.array of warp.vec2 vertex positions.

  • indices (warp.array2d[warp.int32]) – A (num_tris, 3) warp.array of int32 triangle vertex indices, assumed counterclockwise. Modified in place.

  • ref_positions (warp.array[warp.vec2f] | None) – Optional (vertex_count,) warp.array of warp.vec2 reference positions. When provided, flips that would create a degenerate triangle in the reference configuration are rejected. Useful when the working mesh is a deformation of a reference mesh that must stay non-degenerate.

  • max_passes (int) – Maximum number of parallel flip passes before stopping. Must be at least 1.

  • area_epsilon (float) – Minimum signed area required for each triangle produced by a flip; guards against creating inverted or sliver triangles. Must be finite and non-negative.

  • ref_area_epsilon (float) – Degeneracy threshold applied to ref_positions. Must be finite and non-negative.

Returns:

A (1,) int32 array on indices.device containing the total number of edges flipped. Under graph capture, read the value after replaying the graph.

Return type:

wp.array[wp.int32]

Note

Assumes a manifold mesh with consistent counterclockwise winding (positive signed triangle areas).