Skip to main content

Module offset

Module offset 

Source
Expand description

Offsetting chains of lines, arcs and splines — or circles — by a distance, the offset tied to them by constraints so it follows them.

One dimension. The offset of the chain’s first curve is an Constraint::Offset — the distance, a dimension to give. Every other offset curve is only Constraint::Parallel to its line or Constraint::Concentric with its arc, and the distance carries over from one to the next at every corner:

  • where the chain runs on smoothly — Constraint::Tangent there, by constraint — the offsets meet tangentially too;
  • where it turns away from the offset side, a gap opens: closed by an arc round the corner, tangent to both offsets (Corners::Round), or by extending both offsets until they meet (Corners::Extend);
  • where it turns towards the offset side, the offsets cross: both are cut back to where they meet;
  • where it runs on straight — the corner’s offsets end closer than the solver tells points apart, as the halves of a mirrored outline meet on the mirror line — they meet square to the corner.

An arc round a corner has the corner as its center, so its radius is the distance of both offsets it touches. Where offsets meet, a construction circle about the corner, touching both, says the same. An open chain’s offset ends square to the chain’s ends.

Splines. The offset of a spline is no spline. It is fitted: a cubic spline through points of the true offset, with as many control points as it takes to come within [FIT_TOLERANCE] of the sketch’s size of it everywhere, proven (NurbCurve2D::offset_miss). Each of those points is held to the spline, at its parameter, the distance away along its normal (Constraint::OffsetAt), the distance a construction circle’s radius about a corner of the chain — the dimension, if the spline comes first. Where the fit ends at a corner it ends on the true offset, and the curve the chain runs on with meets it there; where it ends where offsets cross, its end is held only across the spline, and slides along the offset to where the other one is.

Crossings. Where a piece is too short for the corners at its ends, or offsets run into each other — offsetting into a notch narrower than twice the distance — the offset drawn round the chain crosses itself. It is cut where it does, and what lies nearer the chain than the distance dropped: what is left runs on from part to part at the crossings, each part still tied to its source. A part cut off at both ends from the corners that carry the distance holds it by a circle about its source’s corner touching it, as large as one about the first part’s: one dimension still says how far all of it is.

Several chains at once. An outline and its holes, offset together, each go into the same area: of two closed chains one inside the other, one inward and the other outward. Each is run the way that has that area on its left, so that where their offsets cross they are cut and run on from one into the other, as a chain’s own do; a part of another chain holds the distance as a part cut off does. A circle among them keeps its offset whole, held by a construction circle on it, level with its center, as large as the distance.

Refused: an arc offset past its center, a spline offset past its center of curvature, a circle’s offset that another crosses, and an offset that leaves nothing.

Structs§

Offsetted
An offset made: the curves of the offset, and the dimension of its distance.

Enums§

Corners
How an offset closes the gap where its chain turns away from it.