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

  • Combining runs over different days

    Joins the results of several runs of the same site into one, weighting each by its number of days.

    hours = Σ (hoursᵢ × daysᵢ) ÷ Σ daysᵢ

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    32-bit in part
  • Ground hours as CSV

    Writes each ground cell's center and its hours of sun a day.

    x, y to 3 decimals; hours to 2 decimals

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    32-bit in part
  • Wall hours as CSV

    Writes each wall's facing direction and the hours of sun a day on each floor.

    facing = round((90 − normal·180 ÷ π) mod 360); hours to 2 decimals

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    64-bit
  • Turn angle at a point

    The signed turn of the line at a point of intersection.

    Δ = atan2 of the leg after − atan2 of the leg before, wrapped to (−π, π]

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Tangent length of each curve

    The turn and the tangent length each curve takes on either side of its point.

    T = r × tan(|Δ| ÷ 2)

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Largest radius that fits

    The largest radius at a point that fits between its neighbors' curves as they are.

    room = min(d_before − T_before, d_after − T_after); r_max = room ÷ tan(|Δ| ÷ 2)

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Overlapping curves and the fixes offered

    Finds neighboring curves whose tangents overlap and offers radii that fit.

    overlap when Tₐ + T_b > L + 1e-9; both scaled by f = L ÷ (Tₐ + T_b); offered radius = floor(r × 100 + 1e-9) ÷ 100

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Vertical curves that do not fit

    Finds vertical curves longer than the room between their neighbors and offers the longest length that fits.

    A = (g₂ − g₁) × 100; L = K × |A| when given by K; room = 2 × min(back, forward); offered L = floor(room × 100 + 1e-9) ÷ 100; K = L ÷ |A|

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Stations to stake

    Every multiple of the step between two stations, both ends, and the alignment's own curve points in between.

    sta = k × step for whole k; neighbors closer than 1e-6 merged

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Stake position

    The coordinates of a stake at a station and an offset to the right or left.

    x = xₚ + off × sin(dir); y = yₚ − off × cos(dir)

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Stake rows with cut or fill

    One row per station and offset with design elevation, ground elevation and cut or fill.

    cf = ground − design (positive = cut)

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Survey points against the alignment

    Each survey point's station and offset on the alignment, the design there and the cut or fill to the point's own elevation.

    cf = point elevation − design

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Staking table as CSV

    Writes the stake rows to a CSV file.

    northing, easting, design, ground and cut or fill to 3 decimals; offset and the C/F column to 2 decimals

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Millimeters per project unit

    The factor from project feet or meters to millimeters.

    m: 1000; ft: 1,200,000 ÷ 3937 (US survey foot)

    Drainage structure types and their library items structs.js
    • CivilCraft
    Exact
  • Inside and outside size of a structure

    The inside and outside width and length, the wall and the frame of a structure in project units.

    inside = size ÷ P; outside = inside + 2 × wall ÷ P; P = 12 (inches per foot) or 1000 (mm per m)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Plan shapes of a type

    The outside wall, inside wall and frame opening of a type as plan shapes in millimeters.

    r = round₆((size × M) ÷ 2); M = 25.4 (inch) or 1 (mm)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Round outline as a polygon

    The outline of a round structure's body as points on a circle.

    pᵢ = (r·cos(2π·i ÷ n), r·sin(2π·i ÷ n)), n = 48

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Library item of a type

    The library item for a type: its body from the underside of the floor slab to the rim, its sizes, and every parameter in millimeters.

    H = depth × U + base × M; body = outline from −H to 0; parameters as text of (value × factor)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Type read back from a library item

    Turns a library item's millimeter parameters back into a type in the project's units.

    value = millimeters ÷ M (sizes) or ÷ U (sump, depth)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Follower behind a leader (tractrix)

    Where a rear axle ends up when the point that pulls it moves along a straight piece.

    α₁ = 2·atan(tan(α₀ ÷ 2) × e^(−d ÷ L)); follower = B + L × (−w turned by α₁)

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Steady-state turning radii

    The radius each rear axle and hitch runs on when the front axle follows a circle for ever.

    r = √(max(0, R² − L²)); hitch = √(r² + c²)

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • Stepping along the path

    Cuts the path into steps no longer than the step length, with a point and travel direction on every line and arc.

    step = max(0.001, shortest wheelbase ÷ 40); k = ceil(L ÷ step); s = s₀ + L·j ÷ k

    Vehicle swept paths swept.js
    • CivilCraft
    64-bit
  • 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

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.