Skip to main content

Module offset

Module offset 

Source
Expand description

Offset pieces of a station basis: the curve beside a span of an atomic curve, measured in its own length (#289, ADR 0082 amendment).

A StationOffset is the curve C(v) = B(v) + D(v) beside a base piece B (a StationPiece of an atomic curve, reversed or placed), v the base’s station measure into the piece and D the displacement its OffsetLaw gives in the base’s frame at v:

  • OffsetLaw::Planar: d along the base’s left lateral, on a 2D base (an offset curve 2D: positive to the left, the orthogonal complement of the tangent);
  • OffsetLaw::Directed: d along normalise(V x T), T the base’s unit tangent (an offset curve 3D); a tangent parallel to V is refused by name;
  • OffsetLaw::Linear: lateral, vertical and longitudinal offsets interpolated linearly in v between the piece’s ends, in the base’s section or plan frame (one interval of an offset by distances).

§Distance convention

A station on an offset is measured in the OFFSET’s own length from its start (the base piece’s start), not in the base’s: its arc length, or, where the base is plan-measured (an elevated or banked curve), its own plan length (the arc length of its plan projection), so an offset of an alignment keeps the alignment’s convention and joins plan-measured pieces. The offset’s frame is its own section frame: the planar frame of its own tangent where it runs horizontally in a horizontal plane, else the reference-up frame against +Z of its own point and tangent; an offset of a banked curve keeps the base’s rolled lateral, made perpendicular to its own tangent.

§Exactness

A constant offset of a line is a line beside it, and a constant offset (no longitudinal part) of a circle whose offset stays in planes normal to its axis (a 2D or horizontal circle under a planar, section or plan law, any circle under a reference direction along its axis) is a circle of radius r - a, a the displacement towards the centre: its length is the base’s scaled by (r - a) / r, read in closed form. Every other offset is read numerically: its speed is the base’s tangent plus the derivative of the displacement by a five-point difference, integrated by adaptive Gauss-Legendre to OFFSET_TOLERANCE and inverted by a safeguarded Newton step within a panel. That is an estimate, not a proof: a frame on such an offset is never exact, and a mesh placed in it is Unbounded by name.

§Refusals

By name: a base that is itself an offset, a base span with a seam of its curve inside it (split it there, as offset_pieces does), a 2D law on a 3D base, a circle whose offset radius collapses to zero or below, an offset whose speed in the base’s direction falls to CUSP_TOLERANCE of the base’s or below (a cusp, or a reversal), and an offset lying in a horizontal plane that crosses itself within the piece.

Structs§

StationOffset
An offset of one base piece, measured in its own length; see the module documentation.

Constants§

CUSP_TOLERANCE
Smallest speed of an offset in its base’s direction, relative to the base’s, that is not a cusp; also the smallest scale (r - a) / r of an offset circle that has not collapsed.
OFFSET_TOLERANCE
Relative tolerance of a numerical offset’s own length and its inverse: OFFSET_TOLERANCE * max(1, L) in the length unit. An estimate, as the quadrature’s agreement test is.

Functions§

offset_pieces
The offset of pieces laid end to end (a composite’s, in its measure) by law: one StationOffset piece per span of a base piece between the seams of its curve, so every seam and joint of the base is a joint of the offset. A OffsetLaw::Linear law runs from its start at the first piece’s start to its end at the last piece’s end, linearly in the base’s measure.