Skip to main content

self_intersection_heuristic

Function self_intersection_heuristic 

Source
pub fn self_intersection_heuristic(
    current_vertices: &[[f64; 3]],
    original_vertices: &[[f64; 3]],
    faces: &[[usize; 3]],
    _voxel_size: &[f64; 3],
) -> f64
Expand description

Compute self-intersection heuristic by comparing vertex distances between current and original mesh.

This is based on FSL-BET2’s self_intersection method which:

  1. Computes mean edge length for both meshes (ml, mlo)
  2. For vertex pairs that are currently close (< ml apart), checks if they’ve gotten significantly closer than they were in the original mesh
  3. Accumulates squared differences in normalized distances

Returns a scalar value where > 4000 indicates likely self-intersection. The threshold of 4000 matches FSL-BET2’s self_intersection_threshold.

Note: Vertices are expected to be in mm coordinates.