Skip to main content

sew

Function sew 

Source
pub fn sew(
    model: &mut Model,
    faces: &[Shape],
    tol: Tolerances,
) -> OgeomResult<Sewn>
Expand description

Sew free faces into shells by finding the edges they share.

Two edges are the same edge when their ends coincide within tolerance (either way round) and a point along them does too. The midpoint test is what stops two different arcs between the same pair of vertices from being merged into one, which is a real case: the two halves of a circle share both ends.

Each face keeps its material on the left of its rings, so two faces sharing an edge walk it opposite ways. Where two faces of a shell walk a shared edge the same way, the shell’s faces are turned over breadth first across their shared edges until each is walked once each way, keeping the orientation most of them already have (open shells too); a closed shell whose faces were turned is then made to face out of the volume it bounds. A closed shell whose faces already agree is kept as given, facing in or out: it may bound a void, which only the solid it joins can say, and make_solid turns it to face out as an outer shell or in as a void. A shell that admits no such orientation (a band with a half twist) keeps its faces as given, and Sewn::edges_walked_one_way names the edges that show it.

Nothing is moved. See the module documentation. What the faces share with other shapes is copied before the sewing edits it (Model::unshare_each); the history runs from the faces given.

§Errors

OgeomError::Construction if faces is empty or holds something that is not a face; OgeomError::Dangling if a handle fails to resolve.