MEDYAN.is_inside_chem_boundary!

Tuple{MEDYAN.Context, StaticArraysCore.SVector{3, Float64}, Float64}

is_inside_chem_boundary!(
    c::MEDYAN.Context,
    position::StaticArraysCore.SVector{3, Float64},
    min_distance::Float64
) -> Bool

Conservatively check if a position is inside the chem boundary by at least min_distance nm.

Uses the cached TSDF to provide a conservative (never false-positive) estimate. Returns true only if we can guarantee the point is inside by at least min_distance. Returns false if the point might be outside or within min_distance of the boundary.

The algorithm uses the TSDF values at the 8 vertices of the containing voxel. For each vertex with TSDF value t_v (negative = inside), and distance r from the query point to that vertex, the boundary is between t_v + r and t_v - r away from the point.

If the point is outside the TSDF grid, returns false (conservative).

The TSDF grid spacing defaults to the chem voxel spacing / 4. The oversampling factor can be increased with set_chem_boundary_oversampling_factor!. The TSDF max distance can be increased with set_chem_boundary_tsdf_max_distance!. If min_distance > max_distance - sqrt(3)*grid_spacing an error is thrown.