Skip to main content

Module fix_shape

Module fix_shape 

Source
Expand description

One entry point over a shape nobody promised was well-formed.

The exchange readers heal what their corpus exhibits, inline and in a fixed order; a shape built by a caller, or read from a file the corpus does not resemble, has no such pass. This is it: diagnose, mend what a mend is known for, diagnose again, and say what changed and what did not. Nothing is moved that the model’s own tolerances do not already call the same place, and nothing is dropped that the model says is there: a face with area is a face, whatever its shape.

What is mended, in order:

  • a wire whose edges are not end to end is put in the order that walks them, where one exists;
  • an edge shorter than its own vertices’ tolerances (the two ends the same point by the model’s own admission) is collapsed, its two vertices made one;
  • where one edge of a wire ends at a vertex and the next begins at another, no farther apart than a fitted trim may stand off its surface, the two vertices are made one, wide enough to reach both: the same slop as a curve ending away from its vertex, and stated the same way. A gap past that reach is a missing piece of boundary;
  • such a gap is filled with a straight edge where that edge is provably the one lacking: the gap is shorter than every edge of each face it is in and no other vertex of those faces stands as near its ends, the line lies on each face’s surface within the face’s tolerance along the chart segment between the edges either side, and each face, filled, checks clean. A gap two faces share gets one edge with a pcurve on each. Any other gap stays reported;
  • a boundary that crosses a pole of its surface (a sphere’s, a cone’s apex) with no edge spanning the pole’s row of the chart is given a degenerate edge there;
  • an edge holding its column on a closed surface as plain pcurves, walked once each way on two columns a period apart, is made a seam of the surface (join_seam_columns);
  • an edge with no pcurve on a face it bounds is given the trim projection can honestly fit, as the readers do;
  • a wire that runs out along an edge and straight back along the same curve, within the tolerance either edge states and on one copy of the chart, with no other face walking either edge, loses the pair (a tail); a hole made of such pairs alone goes. Where one of the two runs farther than the other (a notch), the longer is cut where the shorter turns back, and the stretch out to the tip goes with the shorter edge (see tails);
  • a hole every point of which stands within the face’s tolerance of the hole’s boundary, which no neighbour walks, goes: by the face’s own tolerance it encloses nothing. That is proved on the chart drawn to the scale of a bound on how far the surface carries a step of it, on a plane, a cylinder, a cone, a sphere, a torus, a B-spline patch, and a revolution or extrusion of a B-spline (see small_wires);
  • a boundary that crosses itself once in its surface’s chart is mended where the mend is the one it says (see crossing): two consecutive edges crossing short of the vertex they meet at, by no more than a fitted trim may stand off its surface, are cut back to the crossing and the vertex moves there, widened to reach where it stood; any other crossing of one wire splits its face into the figure eight’s two loops. Each face changed must check clean after and cross itself nowhere; the report counts the faces still crossing themselves;
  • a face with no wires on a surface whose domain is its whole extent (a sphere, a torus, a patch) is bounded by that domain’s sides, with a seam edge where the surface closes and a degenerate edge where it pinches to a pole, or else marked as covering it;
  • loose faces (a compound of them, or an open shell) are sewn where they share edges. Two free edges of their faces that are each other’s twin across a gap no wider than a fitted trim may stand off its surface, the gap shorter than every edge of either face and no other vertex as near their ends, first state that gap, each edge and vertex as wide as its own, where sewing a copy of the shape shows the pair joins (see free_gaps);
  • faces two of which walk an edge they share the same way are turned until each such edge is walked once each way, a shell’s as sewing turns them, a solid’s keeping the orientation most of each run of them has;
  • a run of a solid’s faces facing into its material is turned, where most of its faces read that way;
  • tolerances are tightened to what the geometry needs;
  • an edge whose pcurves stand off its curve by more than it states, and a vertex a curve it bounds ends away from by more than either states, widen to the gap measured, where that gap is within the reach a fitted trim is allowed: slop a reader would have recorded the same way. A gap past that reach is no slop and stays reported.

The free edges of the shape as mended come back chained into contours (free_bounds), each of which FreeBounds::wires makes a wire.

What is not, and where it lives: small faces and small solids stay (removing a face opens the shell it is in; that is defeaturing, and the boolean crate has it for the features it knows), and a face across a grid of patches is not rebuilt as one.

Structs§

FixReport
What fix_shape did, and what it found before and after.
Fixed
A fixed shape: the result, its history, and the report.

Functions§

fix_shape
Mend shape where a mend is known for what is wrong with it.