Skip to main content

capture_rest_sizes

Function capture_rest_sizes 

Source
pub fn capture_rest_sizes(mesh: &mut Mesh) -> Result<()>
Expand description

Records every vertex’s rest size for split_stretched: the longest edge on it, or on any vertex at exactly its position. Replaces an earlier capture, and builds the mesh’s vertex index if needed.

Call it before the deformation starts, and keep it across strokes that should share one density: capturing again accepts what earlier strokes stretched as the new rest shape, which ensure_rest_sizes avoids. This is not an edit: no undo step, no journal entry, and the mesh’s revision does not change. It costs one pass over the triangles and a sort of the vertices.

The sizes last as long as they are true: a topology edit other than split_stretched drops them (undoing that edit brings them back), and so does undoing or redoing an edit from before the capture. split_stretched then fails until they are taken again. Moving vertices does not drop them, whichever tool does it: that is the stretch they measure.

§Errors

OpsError::Store when memory runs out; the mesh keeps any earlier capture unless the failure comes after it is replaced.