Skip to main content

Module certify

Module certify 

Source
Expand description

Certified lengths of station pieces, and so certified joint and seam distances (#294, ADR 0082 amendment).

A composite basis places its joints at the running sum of its pieces’ lengths (super::CompositeBasis). Most of those lengths are read from stored data – a line’s, a circle’s, a polyline’s, an intrinsic curve’s, a chain’s, an elevated or banked curve’s plan distance, a constant offset of a line or of a circle – and are exact, rounding aside. The others are quadratures, estimates to super::OFFSET_TOLERANCE or the arc-length tolerance: an ellipse, a B-spline, and every other offset. This module bounds those from both sides, so that a joint’s distance is a DistanceInterval that CONTAINS the true sum of the lengths before it, measured between the points the kernel reads as each piece’s ends.

§Chords and their deficit

Where the measured curve P(t) is evaluated in closed form at its native parameter – a line, a circle, an ellipse or a B-spline, and any offset of one, 2D or 3D, measured by arc length – each panel [a, b], h = b - a, is bounded by its chord c = |P(b) - P(a)| and certified bounds M2, M3 on |P''|, |P'''| there:

  • c is a lower bound of the arc length (a chord is never longer);
  • |P'(v)| >= m = |P'(mid)| - M2 h / 2 everywhere on the panel, so the tangent turns by at most beta = h M2 / (2 m) from the midpoint’s and the arc length is at most c / cos(beta);
  • the deficit L - c is bounded from both sides through the velocity across the chord, a zero-mean function whose square integral M2 bounds as h^3, and M3 with the panel’s own velocities to within h^4 (#307; see the panels module), so a panel’s width falls as h^4.

The panels are refined adaptively: the widest is halved first, until their widths sum to an eighth of the tolerance (panels::adapt), so an ordinary curve certifies to 1e-8 relative and below within the budget. M2 and M3 come from the certified derivative suprema of crate::bound (|B''| to |B''''| of the base) and, for an offset, the frame’s: a unit vector w / |w| has |u'| <= |w'| / r, |u''| <= |w''| / r + 3 |w'|^2 / r^2 and |u'''| <= |w'''| / r + 9 |w'| |w''| / r^2 + 15 |w'|^3 / r^3 where r bounds |w| from below (|B'| for the tangent, |B'_xy| for the reference-up lateral, |V x B'| for a 3D offset’s direction), and Leibniz for each law component times its axis. Each point carries a rounding error of POINT_ROUNDING relative to its largest coordinate, which widens the chain of chords.

An offset by distances along an ellipse or a B-spline (#307) reads its law in the base’s arc length, a quadrature: the base is measured by chords first, and the law at a native parameter is read through that certified length (see the beside module), the measured curve being the offset whose law runs linearly in the base’s true arc length between the points the kernel reads as the piece’s ends.

§Midpoints of a speed in closed form

Where the base is parameterised by its own arc length in the plan and its curvature is a law – an intrinsic curve or a chain (2D), a 3D intrinsic curve with no torsion in a level plane (#302), the plan of an elevated curve (measured by plan length) – the offset’s speed is a closed form in the base’s curvature k and, in a section frame that leans with the grade, the grade p = z': for a displacement a along the left normal, b along the plan tangent and c vertical, all linear in the base distance v,

f = sqrt((1 + b' - a k)^2 + (a' + b k)^2 + c'^2)

(c' only where the offset is measured in 3D, beside a 2D base or a level 3D intrinsic curve), with b = longitudinal * cos g - vertical * sin g, tan g = p, in a section frame beside an elevated curve and b = longitudinal otherwise. Each panel is the midpoint rule, h f(mid), within h^3 / 24 sup |f''|; sup |f''| is assembled from suprema of k, k', k'' (the law and its derivatives) and of z' to z'''' (the profile’s) by the Leibniz and chain rules, with f >= inf (1 + b' - a k) > 0 (a cusp is refused). Its panels are refined adaptively too.

§Refusals

By a typed GeomError::UnsupportedInput naming UNCERTIFIED_LENGTH: an offset of a banked curve, of a 3D intrinsic curve with a torsion law not identically zero or out of a level plane (a start tangent or normal with a z component), of a chain’s parametric piece or of an elevated curve with an intrinsic profile in a leaning frame; a 3D offset direction that is not vertical beside a plan-parameterised base; a base placed in a frame that tilts +Z there; a skewed frame; and a tolerance the rounding of the points already exceeds. A tolerance the budget of MAX_CERTIFIED_PANELS panels does not reach is GeomError::BudgetExceeded.

Structs§

DistanceInterval
A distance certified to lie in [lower, upper]: what CurveEvaluator::path_joint_distances returns for each joint of a curve path.

Constants§

MAX_CERTIFIED_PANELS
Most panels one certified length may use.
POINT_ROUNDING
The rounding error of a point evaluated in closed form, relative to the largest coordinate magnitude of the curve’s data, the point and the displacement (at least 1): about 45 units in the last place, several times what a de Boor or conic evaluation and a frame accumulate.
UNCERTIFIED_LENGTH
The input a length no certified bound here reaches is refused for.