Skip to main content

thicken_trimmed_sheet

Function thicken_trimmed_sheet 

Source
pub fn thicken_trimmed_sheet(
    surface: &NurbsSurface,
    loops: &[Vec<NurbsCurve>],
    thickness: f64,
    symmetric: bool,
) -> Result<Vec<BrepSolid>, String>
Expand description

§5.9 THICKEN a TRIMMED sheet region into a closed solid.

loops are parameter-space curves on surface exactly as FaceRecord loops store them: the outer loop first, running counter-clockwise in (u, v), followed by optional hole loops running clockwise (the same_sense = true convention of validate_uv_wire). Each loop’s pcurves must chain tip-to-tail and close; a loop may also be a single closed pcurve (e.g. a rational circle).

  • symmetric = false: the solid occupies the space between the sheet and its offset at signed thickness along the sheet normal n = Su × Sv (negative thickness grows the solid on the −n side).
  • symmetric = true: the material splits evenly, |thickness|/2 on each side of the sheet (the sheet becomes the mid-surface).

The caps are the bottom/top offset sheets trimmed by the SAME pcurve loops (the offset shares the sheet’s basis, so pcurves transfer verbatim); every boundary pcurve contributes one ruled side wall between its bottom and top 3D images, ruled pointwise at equal pcurve parameter — for an offset pair that ruling runs along the surface normal, so walls are exact wherever the full-domain walls were. Hole loops produce inner wall tubes and each adds one handle: genus = loops.len() - 1.

Every boundary edge is a single EdgeRecord shared by exactly two coedges (cap + wall); wall-to-wall junction edges are likewise shared.

A general (non-iso) pcurve on a CURVED sheet is no longer refused: its two 3D images come from crate::image_curve::image_curve_pair, which fits the composed curve-on-surface on both sheets over ONE shared parameter set (the basis identity [ruled_wall] requires) and refuses only when the fit misses its measured tolerance. Unlike a push against a FIXED neighbour, both sheets here move together, so the image of the shared trim IS the boundary.

Returns one BODY per regular piece of the selected trim. That is one body for a trim the offset is regular over, and one for a trim the fold locus splits in two (the folded half is dropped) — but a fold BAND across the trim is bounded by TWO locus branches and leaves TWO regular pieces, and each of those is its own body: they share no edge, because the dropped band lies between them.

Refuses (Err) on: zero/non-finite thickness, closed sheets, open or misoriented loops, pinched loops, a general pcurve image that cannot be fitted to tolerance, and offsets that fold through the evolute INSIDE THE SELECTED TRIM (a fold the trim excludes is not this sheet’s problem) that the carve cannot divide the trim along.