Skip to main content

to_shape

Function to_shape 

Source
pub fn to_shape(
    model: &Model,
    shape: &Shape,
    points: &[Point],
    normals: Option<&[Vector]>,
    options: &DistanceOptions,
    tol: Tolerances,
) -> OgeomResult<Vec<Option<Closest<ShapeFeature>>>>
Expand description

The signed distance from each point to shape‘s faces, edges and vertices, measured on their own surfaces, curves and points, 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 candidates are PointDistance’s: each vertex, the foot on each edge, and the foot on each face’s surface where it lands inside the face. A foot within the trimming rings’ polylining band of the face’s boundary is placed again against rings drawn a hundred times finer, and again, down to the confusion distance, for as long as it is nearer than every other candidate and the band cannot tell; one still in the band where the rings can be drawn no finer is left to the edges and vertices round it, as PointDistance::nearest leaves it. Equally near candidates go to the vertex before the edge before the face, and among those to the first the shape holds. 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.

A face’s foot is its surface’s nearest point to the query, as project_on_surface finds it: on a surface with more than one local nearest point, a nearer one inside the trim than the one found outside it is not a candidate.

§Errors

As to_mesh for the options and normals; as PointDistance::of for the shape, and as the projections and SolidBoundary::holds report.