Formula reference
Every engineering formula the program computes — with variables, units, and where it lives in the source.
Units throughout: speed km/h, lengths m, rates as fractions (0.06 = 6%), K-values m per 1% of algebraic grade change.
Horizontal geometry
Curvature & bearing
- Tangent: P(s) = start + s·(sin b, cos b); bearing constant.
- Circular: constant κ = 1/R; bearing change Δb = s/R (rad).
- Clothoid: κ(s) = κ₀ + (κ₁ − κ₀)·s/L (linear curvature) — see below.
Clothoid (Euler spiral) — derivation & integration
A clothoid is the transition whose curvature changes linearly with arc-length, so lateral acceleration ramps smoothly. yu3d stores it by its start point, start bearing, start/end curvatures (κ₀, κ₁, signed) and length L.
Heading is the integral of curvature (heading turns at the rate of the curvature), plus the start bearing θ₀:
Position integrates the unit heading vector. In the project's bearing convention (0° = North, heading = (sinθ, cosθ)):
How the integrals are taken
yu3d evaluates x(s), y(s) by adaptive Gauss–Kronrod quadrature
— Boost.Math gauss_kronrod<double, 15> (the G7–K15 rule:
a 7-point Gauss estimate embedded in a 15-point Kronrod estimate), recursed to
max_depth = 10.
- The 15-point Kronrod value is the result; the difference from the embedded 7-point Gauss value is a cheap error estimate.
- Where the estimate exceeds tolerance (a long or very tight spiral whose integrand oscillates), the interval is bisected and recursed (up to depth 10) — that's the “adaptive” part.
- For typical road spirals (L ≈ 10–200 m, |Δκ| < 0.05) the 15-point rule is already far below drawing tolerance with no recursion.
Curvature at s is returned exactly from the linear law; only the position needs quadrature. This is why a clothoid is more expensive to sample than a tangent or arc (which have closed-form positions).
Transition family (Bloss, cosine, sine, Helmert)
The clothoid is the linear member of a family: every transition ramps the curvature from κ₀ to κ₁ over the length L, and only the shape of the ramp differs. Write u = s/L (0…1) and let f(u) be the shape function:
| Law | f(u) | f′(0), f′(1) | Character |
|---|---|---|---|
| Clothoid | u | 1, 1 | curvature changes at a constant rate; a corner in the rate at each end |
| Bloss | 3u² − 2u³ | 0, 0 | rate starts and ends at zero — no jolt at the joints |
| Cosine | (1 − cos πu) / 2 | 0, 0 | smooth like Bloss, slightly gentler in the middle |
| Sine | u − sin(2πu)/(2π) | 0, 0 | smoothest ends, steepest middle |
| Helmert | 2u² (u ≤ ½) 1 − 2(1−u)² (u > ½) | 0, 0 | two parabolas meeting at mid-length; the classic German railway ramp |
The invariant worth knowing: whatever the law, the total deflection over the transition is the same:
Cubic parabola
The classical railway transition, defined in Cartesian form rather than by arc length:
Because the shape is an approximation by construction, the curvature at the end stays slightly below 1/R — that is the classical definition, and yucad3d keeps it rather than “fixing” a curve the standards define this way.
Minimum curve radius
Superelevation & runoff
Design rate by radius (AASHTO Method 2)
Runoff length
Runoff placement (no-spiral curve)
At a direct tangent↔curve boundary the runoff is split across the PC/PT:
exit: e at (B − (1−f)·Lr) → 0 at (B + f·Lr)
Banking a point
Effective rate at a station
A simple legacy helper also exists — proportional to curvature,
e = −κ × 6.0 clamped to ±8%
(superelevation_rate()) — but the corridor's auto banking uses
the Method-2 runoff diagram above.
Curve widening
The widening tapers over a transition length and is interpolated per station, the same way superelevation runs off.
Vertical curves & sight distance
Parabolic vertical curve
Circular vertical curve (exact)
Some standards specify a circular arc rather than a parabola. yucad3d evaluates it exactly — no small-angle shortcut — which matters on steep grades where the two differ visibly.
Not implemented on purpose: the vertical clothoid that IFC 4.3 also allows. Its exact z(s) definition is not published unambiguously, so importing one is refused with a reason rather than approximated by a parabola.
Algebraic grade change & K
Stopping sight distance (SSD)
Crest & sag K-values
Railway cant
Equilibrium cant
Computed cant follows the curvature, so it ramps naturally through a transition and steps at a bare tangent–arc joint. Sign convention: positive = right-hand curve (the left rail is raised).
Stored cant profiles
A cant profile that came from a file (IFC, LandXML) is data, not a calculation, and yucad3d keeps it verbatim: segments of (start station, length, start/end cant, law). The laws are the same shape family as the horizontal transitions:
Where a stored profile exists it OUTRANKS the formula — the file's numbers are the engineer's decision. The Viennese bend is deliberately not implemented: its published definition is a 7th-order form we have not been able to verify, so importing one is refused rather than guessed.
Surfaces (TIN)
Delaunay triangulation
Incremental Bowyer–Watson insertion: for each new point, remove every triangle whose circumcircle contains it (the in-circle predicate), then re-triangulate the cavity. Breaklines are enforced by Lawson edge flips.
Elevation by barycentric interpolation
Cut / fill volumes
fill = Σ(zdesign − zexist)·cell² (where design > exist)
net = fill − cut
Georeferencing & scale factors
A line's combined factor is the mean of its endpoints' factors.
Design-standard constants
See Design standards for the per-standard
table (emax, cross slope, perception time, deceleration, sight
heights). Source: src/geom/src/DesignStandard.cpp.
Side friction f (AASHTO, km/h → f)
30→0.28, 40→0.23, 50→0.19, 60→0.17, 70→0.15, 80→0.14, 90→0.13, 100→0.12, 110→0.11, 120→0.09, 130→0.08 (linearly interpolated).
Max relative gradient Δ (AASHTO, km/h → Δ)
30→0.75%, 40→0.70%, 50→0.65%, 60→0.60%, 70→0.55%, 80→0.50%, 90→0.47%, 100→0.44%, 110→0.41%, 120→0.38%, 130→0.35%.
Worked examples
Minimum radius @ 80 km/h (AASHTO)
Superelevation runoff length
Stopping sight distance @ 80 km/h (AASHTO, level)
Crest K @ 80 km/h (AASHTO)
help/README.md). The source paths above are the single
source of truth; the worked numbers are illustrative and rounded.