pub fn signed_distances(
mesh_b: &Mesh,
bvh_b: &Bvh,
sign: &SignData,
points_in_b: &[[f32; 3]],
max_distance: f32,
out: &mut [f32],
) -> Result<()>Expand description
Signed distances from points_in_b (in mesh B’s local coordinates) to
mesh B: out[i] gets the value for points_in_b[i].
- The magnitude is the distance to the closest point of B, from
fast_mesh_query::closest_point. - The sign comes from
sign(seeSignData): negative behind the surface (inside), positive in front of it (outside). A point exactly on the surface gets+0.0; a point whose side is undecided (exactly in the tangent plane of its closest feature) counts as outside. - A point farther than
max_distancefrom the surface (inclusive bound) getsf32::INFINITY, meaning far, with no sign. That includes points deeper inside thanmax_distance. An infinitemax_distancecomputes every point.
Nothing is allocated per point. With the parallel feature, large
batches run in chunks on rayon’s pool, each chunk into its own buffer;
the values are the same, bit for bit.
§Errors
Everything is checked before anything is written, so on error out is
unchanged:
FieldsError::InvalidInputwhen the slices differ in length, a point is not finite (NaN or infinite), ormax_distanceis negative or NaN;FieldsError::QuerywithMeshMismatchorStaleBvhwhenbvh_bdoes not match the currentmesh_b;FieldsError::InvalidInputwhensignis not current formesh_bandbvh_b(seeSignData::is_current).