Skip to main content

to_mesh

Function to_mesh 

Source
pub fn to_mesh(
    index: &Bvh,
    points: &[Point],
    normals: Option<&[Vector]>,
    options: &DistanceOptions,
) -> OgeomResult<Vec<Option<Closest<MeshFeature>>>>
Expand description

The signed distance from each point to the mesh index was built over, with the closest point, the feature it lies on and the normal there; in the points’ order, None where nothing is within DistanceOptions::max.

The closest point is Bvh::nearest’s, and with a facing limit Bvh::nearest_where’s over the triangles facing within the limit of the point’s normal: exactly what brute force over the same triangles finds, ties to the lowest triangle. A point that is not finite, or with a facing limit a normal that has no direction, answers None. See the module for how the sign is read.

§Errors

As DistanceOptions::check; OgeomError::Dimension if there are normals but not one per point, and OgeomError::Domain if there is a facing limit and no normals.