Skip to main content

make_filling_n

Function make_filling_n 

Source
pub fn make_filling_n(
    model: &mut Model,
    boundary: &[FillBoundary],
    constraints: &[Shape],
    tolerance: f64,
    tol: Tolerances,
) -> OgeomResult<Filled>
Expand description

Fill the hole a loop of edges bounds with one face meeting each side’s support at the continuity asked.

The sides may come in any order and either direction; they must chain into one simple closed loop, each side’s end meeting the next one’s at a shared vertex node or where the two vertices lie within their own and their edges’ tolerances of each other. constraints are vertices and edges inside the hole that the surface passes through. The surface is a cubic B-spline height patch over the plane the loop spans, fitted by least squares to the sides’ positions, to the tangent planes of G1 and G2 sides’ supports and to the normal curvatures of G2 sides’ supports, with a thin-plate bending energy settling the rest, weighted from tolerance so it costs the conditions a small share of it; the control net is refined until every side meets tolerance and the conditions’ residual no longer outweighs the energy, or the refinement runs out. Where a corner of the loop is seen smooth along the plane’s normal (two sides meeting at an angle, each in a plane through that normal), no height over the plane meets both sides there; nor does one where a G1 or G2 side’s support stands within about 6 degrees of square to the plane, as a tube’s wall does to its rim. The patch is then fitted in all three coordinates over a chart drawn from the loop itself, whose corners are the loop’s: a tangent side fixes the patch’s derivative across it to run into the support, square to the edge, at the side’s own speed (so a cap leaves a tube’s rim along the wall and crowns above it), and a G2 side fixes the second derivative across it to bend as the support does; the net is refined until the patch also does not fold over inside the hole. The face is trimmed by the given edges themselves where they are not placed and share vertex nodes end to end, each given a pcurve on the patch; any other side is stood in for by a new edge on its curve between vertices shared round the loop, so the face is one closed wire either way. A placed edge or support is read where it stands. The face faces the way the supports say: across each edge it runs opposite to its support’s use of the edge, so sewing it to the supports gives a consistently oriented shell. With no supports it faces the side the loop turns counter-clockwise about, walked from the first side in that edge’s own direction.

tolerance is the target for every measured deviation: a distance in model units for each side’s gap and each constraint, an angle in radians for a G1 or G2 side’s tangency, and a curvature difference in inverse model units for a G2 side. An edge the surface stands further from than the edge’s own tolerance has that tolerance, and its vertices’, widened to the measured gap.

§Errors

OgeomError::Construction, by name, where:

  • tolerance is not positive and finite, or there are no sides;
  • a side is not an edge, or has no 3D curve or no vertices;
  • the same edge is given twice;
  • a side asks Continuity::C1, Continuity::C2 or Continuity::CInfinity (parametric continuity between two surfaces’ charts), or G1 or G2 with no support;
  • a support is not a face, does not hold its edge, or the edge does not lie on its surface within tolerance;
  • the sides do not chain into one closed loop;
  • the loop encloses no area, or crosses itself seen along the normal of the plane it spans (the plane it encloses the most area seen square to), so the hole is not a height field over that plane;
  • two sides meet at a corner where a G1 or G2 side’s support stands off the other side’s tangent by more than tolerance, so no surface is tangent to it there;
  • a G1 or G2 side’s support uses its edge both ways or neither where the patch is drawn over the loop’s own chart;
  • a constraint is neither a vertex nor an edge, or lies outside the hole seen along the plane’s normal, or is given where the patch is drawn over the loop’s own chart (the message names the corner or the support’s angle to the plane that called for it);
  • the loop’s corners turn so far that no chart drawn from it closes.

OgeomError::NotDone if the finest control net still misses tolerance, naming the side and the deviation.