Resources Numerical accuracy

Calculations

Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • One step forward or reversing

    Moves every unit of the vehicle for one step: the tractor behind its front axle, each trailer behind its hitch, or the chain pushed from the last axle when reversing.

    heading = atan2(leader − follower); hitch = axle − c·(cos θ, sin θ)

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Steering angle and limit checks

    The steering angle at each step and the largest steering and articulation angles, checked against the vehicle's limits.

    δ = atan(wheelbase × Δheading ÷ ±Δlength); articulation = heading of the unit ahead − heading of the unit, wrapped to (−π, π]

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Body corners at a step

    The four corners of a unit's body from its rear axle position and heading.

    corner = axle + a·(cos θ, sin θ) + b·(−sin θ, cos θ)

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Swept area and outline

    The area the bodies sweep and its outline.

    cell h = narrowest width ÷ 40 (× 1.5 until the grid fits); area = filled cells × h²

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Alignment as a path with bulges

    Turns an alignment's lines and arcs into the path the vehicle follows.

    bulge = ± tan(Δ ÷ 4)

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Received power at each grid cell

    The received power at every cell around the transmitter and the share of cells at or above the receiver's sensitivity.

    Pr = Pt + Gt + Gr − (FSPL + J(v_max) + other); covered = cells with Pr ≥ sensitivity ÷ known cells

    Radio coverage over the terrain telecom.js
    • CivilCraft
    32-bit in part
  • Diffraction parameter

    The parameter that measures how far an obstruction rises into the path, used for the knife-edge loss.

    v = h × √(2(d₁ + d₂) ÷ (λ·d₁·d₂))

    Radio coverage over the terrain telecom.js
    • CivilCraft
    64-bit
  • Length of a polyline

    The plan length of a polyline.

    L = Σ √(Δx² + Δy²)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Point at a distance along a line

    The point and direction at a distance along a polyline.

    u = (d − length before the segment) ÷ segment length, clamped to [0, 1]; p = a + (b − a)·u

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Nearest point on a line

    The distance along a polyline and the offset to the side of the point nearest to a given point.

    u = ((p − a)·(b − a)) ÷ |b − a|², clamped; d = length before + u·|b − a|; offset = ± distance, sign from the cross product

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Crossing of two segments

    Where two segments cross, as fractions along each.

    den = r × s; t = ((q − p) × s) ÷ den; u = ((q − p) × r) ÷ den

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • First crossing of two polylines

    The first place one polyline crosses another, with the distance along each.

    d_a = length before + t·|segment a|; d_b = length before + u·|segment b|

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Line square to a polyline

    A straight line square to a polyline at a distance along it, a set length to each side.

    right = (sin dir, −cos dir); p = c − right × left; q = c + right × right length

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Section along a line

    The points of the ground along a line: distance, offset, coordinates and elevation at every triangle edge crossing and line vertex.

    d = length before + t·|segment|; o = d − origin; z from the surface at (x, y)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Elevation of a section at an offset

    The elevation of a cut section at any offset, between its points.

    z = z₀ + (z₁ − z₀)·(o − o₀) ÷ (o₁ − o₀)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Angular misclosure and leg directions

    The angular misclosure of a loop and the direction of each leg after the angles are corrected.

    misclosure = ((again − first) mod 360 + 540) mod 360 − 180; per angle = −misclosure ÷ n; az(i) = az(i − 1) + 180 + angle(i) + per angle

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Station coordinates and linear misclosure

    The unadjusted coordinates of each station, the misclosure at the end and the traverse's precision.

    x += d·cos(dir); y += d·sin(dir); misclosure = √(Δx² + Δy²); precision = total length ÷ misclosure

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Compass rule adjustment

    Moves each station against the misclosure in proportion to the distance run to reach it.

    cx = −Δx × run ÷ length; cy = −Δy × run ÷ length; adjusted = unadjusted + correction

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Traverse report as CSV

    Writes the closure and every station's unadjusted and adjusted coordinates and corrections.

    coordinates and corrections to 4 decimals; distances and length to 3; precision as 1 : whole number; angles to whole seconds

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Frog angle from the frog number

    The angle at which the diverging track leaves, from the frog number.

    θ = 2·atan(1 ÷ (2N))

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Turnout radius, lead and centerline

    The closure radius, the lead and the centerline points of the diverging track.

    R = (g − s·sin β) ÷ (cos β − cos θ); lead = s·cos β + R·(sin θ − sin β); arc length = R·(θ − β)

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Crossover between parallel tracks

    The straight between two turnouts that join parallel tracks, and the overall length.

    straight = (spacing − 2g) ÷ sin θ; length = 2 × lead + straight × cos θ

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Speed on the diverging route

    The speed for a radius, cant and cant deficiency.

    V = √(R·(E + D) ÷ (rail ÷ 127.12)) km/h; rail = 1500 mm gives 11.8

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Vehicle throw on a curve

    How far the middle of a vehicle moves in and its ends move out on a curve.

    inside = b² ÷ (8R); outside = (L² − b²) ÷ (8R)

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Clearance outline on a canted curve

    The vehicle or structure outline tilted by the cant and widened by the curve throw.

    tilt = asin(min(1, cant ÷ base)); rotate each point about the low rail; shift by the inside or outside throw

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Least track spacing for two outlines

    The smallest center spacing at which two clearance outlines do not overlap.

    bisection on the shift between 0 and 20, 60 halvings

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Turn angle at a junction

    The angle a main turns through at a junction of two pipes.

    turn = |atan2 of the leg after − atan2 of the leg before|, folded to 0 to 180 degrees

    Water mains as objects: depths, fittings and take-off water-objects.js
    • CivilCraft
    64-bit
  • Pipe depths and derived fittings

    The elevation of each pipe end, the position of placed objects along pipes, and the fittings the layout implies.

    z = ground − cover; on a pipe: p = a + (b − a)·t; length = stated, else √(Δx² + Δy²); bend angle rounded to 0.1°

    Water mains as objects: depths, fittings and take-off water-objects.js
    • CivilCraft
    64-bit
  • Take-off of pipes and fittings

    The count of each fitting by kind and size and the count and total length of pipe by size.

    length per size = Σ pipe lengths

    Water mains as objects: depths, fittings and take-off water-objects.js
    • CivilCraft
    64-bit
  • Take-off as CSV

    Writes the take-off list to a CSV file.

    length = round(length × 100) ÷ 100; size to 1 decimal

    Water mains as objects: depths, fittings and take-off water-objects.js
    • CivilCraft
    64-bit
  • Ground elevation of a new node

    The elevation stored on a junction, reservoir or tank when it is placed on the plan.

    z = round(ground × 100) ÷ 100; reservoir head = z + 30 (m) or 100 (ft)

    Water mains as objects: depths, fittings and take-off water-ui.js
    • CivilCraft
    64-bit
  • Unit factors

    The factors that turn project units (ft, in, gpm, psi or m, mm, L/s, kPa) into the SI values the solver works in.

    ft = 0.3048 m; in = 0.0254 m; gpm = 6.30902e-5 m³/s; psi per ft = 0.433527; kPa per m = 9.80665

    Water mains network: heads, flows and pressures water.js
    • CivilCraft
    64-bit
  • Pump curve fit

    Turns one or three pump curve points into the head a pump adds at any flow.

    H = H₀ − r·Qⁿ; n = ln((H₀ − H₂) ÷ (H₀ − H₁)) ÷ ln(Q₂ ÷ Q₁); r = (H₀ − H₁) ÷ Q₁ⁿ

    Water mains network: heads, flows and pressures water.js
    • CivilCraft
    64-bit
  • Hazen-Williams head loss

    The friction head loss in a pipe for a given flow, length, diameter and C factor, in SI.

    h = 10.67 × L × |Q|^1.852 ÷ (C^1.852 × D^4.871) × sign(Q)

    Water mains network: heads, flows and pressures water.js
    • CivilCraft
    64-bit
  • Node equations for one pass

    Builds the linear system for the unknown heads from the link coefficients, demands and fixed heads, and solves it.

    Q = P·(Hₐ − H_b) + Y; P = 1 ÷ g; Y = Q − f ÷ g; Σ flows at each node = demand

    Water mains network: heads, flows and pressures water.js
    • CivilCraft
    64-bit

A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.