Skip to main content

containment_lane

Function containment_lane 

Source
pub fn containment_lane(face: &FaceRecord) -> Result<ContainmentLane, String>
Expand description

Which lane of parameter_point_in_face a face’s questions go to, read off the face alone — the kernel’s own lane selection, through the same prepared data the query uses, for a caller that answers some containment questions ahead of the kernel and must know which rule the kernel applies.

The lanes are tried in this order, and a face is in the first whose gates it passes (each comparand is in the carrier’s parameters unless stated):

  1. SeamBand: closed_directions() == (true, true), and the seam-band preparation reads the face — every loop a collapsed puncture (its trace within 1e-3 of the domain span in u and in v), one seam-crossing loop unwrapped (unless SEAM_BAND_MERGED_SWITCH), two loops the seam-band analysis reassembles, or two clean full-wrap rims (a periodic extent of at least 0.6 period and a cross extent of at most 0.05 of the cross span each).
  2. SphereCap: an analytic sphere closed in exactly u with two loops, each winding one period to within 0.05 period and the two opposite, one flat (a v extent within 1e-6 of the v span) at a pole (within 1e-6 of the v span of a v end).
  3. WrappedHorizon: closed in exactly u, at least one loop, neither HORIZON_CONTAINMENT_SWITCH nor (for one or two loops) HORIZON_SINGLE_LOOP_SWITCH, some loop of three or more samples stepping over the seam (a sample-to-sample u step more than a quarter period from its period-folded value), and no loop winding the period (its unwrapped first and last samples more than a quarter period apart).
  4. CoveringRimStrip: closed in exactly u, two loops, not COVERING_RIM_STRIP_SWITCH, a sample beyond the u domain by more than 1e-3 period, each loop travelling one period to within 2e-2 period and closing in v to within 1e-3 of the v span, opposite directions, v hulls apart by more than 1e-6 of the v span, and the lower rim travelling +u exactly when the face is same_sense.
  5. Generic: everything else.

Sampling is trim_sample_count chords per pcurve at trim_station (the seam band: 24). Err is the error the face’s first query would return.

It reads the prepared data of a face a query has prepared, and otherwise prepares what the walk reaches on the side, leaving the thread’s prepared-face cache as it was: asked for every face of a part, it would otherwise push out the faces the queries are using.