meshing.adaptive.sparse_crossing_edges

meshing.adaptive.sparse_crossing_edges(
    sdf,
    grid,
    *,
    level=0.0,
    lipschitz=1.0,
    stats=None,
    return_inside=False,
)

Detect crossing edges without sampling the full lattice.

Octree pruning finds the candidate cells, then only their corner vertices are evaluated. The result is identical to :func:cadjoint.meshing.edge_detection.find_crossing_edges over a dense sample — same edges, same order, same frozen orientations — whenever lipschitz genuinely bounds the field.

Parameters

Name Type Description Default
sdf Callable[[Array], Array] JAX-traceable scalar field (point[3]) -> scalar. required
grid GridSpec Sampling grid. required
level float Isovalue to extract. 0.0
lipschitz float Gradient bound the pruning may assume; see the module docstring. 1.0
stats dict | None Optional dict that receives evaluations (total field evaluations, pruning plus corners) and candidate_cells. None
return_inside bool Also return a boolean inside lattice shaped like :attr:GridSpec.lattice_shape, filled from the corner values already evaluated here (value - level < 0; unevaluated vertices read False). Every active cell is a pruning candidate, so all corners consulted by :func:cadjoint.meshing.features.manifold_cell_incidence carry evaluated values, matching a dense sample exactly. False

Returns

Name Type Description
CrossingEdges | tuple[CrossingEdges, np.ndarray] The crossing edge set, or (edges, inside) when
CrossingEdges | tuple[CrossingEdges, np.ndarray] return_inside is true.