Skip to main content

select_by_normal

Function select_by_normal 

Source
pub fn select_by_normal<M>(
    mesh: &M,
    cone: NormalCone,
    tolerance: Tolerance,
) -> Result<FaceSelection, FaceSelectionError>
where M: TriangleMeshView + ?Sized,
Expand description

Select the triangles whose normal lies within cone.

tolerance.linear() decides degenerate triangles as crate::surface_properties does (any degenerate triangle refuses the mesh); tolerance.angular() is slack added to the half-angle. A triangle is selected when atan2(|N x axis|, N . axis) <= half_angle + angular. A floor tilted by 1e-12 is therefore selected at half-angle zero with Tolerance::METRE but not with a zero angular tolerance, and an exactly level floor is selected either way. A half-angle of pi selects every triangle.

§Errors

FaceSelectionError::MeshNotSurfaceUsable when the audit finds the mesh unusable or degenerate, FaceSelectionError::NonFiniteNormal when a triangle’s normal or area is not finite.