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

  • Attribute value to its storage type

    Converts a list of numbers to the number type its USD attribute type calls for.

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Mesh points and extent

    Stores the points of a mesh and its bounding box in the scene.

    extent = [min x, min y, min z, max x, max y, max z] of the points

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Lamp intensity

    Converts a lamp's lumens to the intensity a renderer reads.

    intensity = lumens ÷ (683 × area × π)

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit, display only
  • Single values in the binary file

    Writes one number, tuple or matrix into the binary USD file.

    USD mesh coordinates in saved and exported files usd/usdc-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Arrays in the binary file

    Writes an array of numbers into the binary USD file.

    USD mesh coordinates in saved and exported files usd/usdc-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Reading a mesh

    The points, faces and attached values of a mesh read from a USD scene.

    USD mesh coordinates in saved and exported files usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Built-in shapes as meshes

    A cube, sphere, cylinder, cone, capsule or plane of a USD scene as a mesh.

    ring point = (r·cos θ, r·sin θ, z), θ = 2π·j ÷ 24

    USD mesh coordinates in saved and exported files usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Elevation grid from a surface

    The elevation at the center of every grid cell, row by row from the north.

    x₀ = ⌊minX ÷ cell⌋·cell; y₀ = ⌈maxY ÷ cell⌉·cell; center = (x₀ + (c + 0.5)·cell, y₀ − (r + 0.5)·cell)

    Surface exported as a GeoTIFF elevation grid geotiff-write.js
    • CivilCraft
    32-bit in part
  • Elevations written to the file

    The tiles or strips of elevation values as they go into the TIFF.

    Surface exported as a GeoTIFF elevation grid geotiff-write.js
    • CivilCraft
    32-bit in part
  • Grid origin and cell size in the file

    The pixel scale and the tie point that place the grid.

    pixel scale = (cell, cell, 0); tie point = pixel (0, 0) at (x₀, y₀)

    Surface exported as a GeoTIFF elevation grid geotiff-write.js
    • CivilCraft
    64-bit
  • Default cell size

    The mean plan length of the surface's triangle edges, offered as the cell size.

    Σ |edge| ÷ number of edges

    Surface exported as a GeoTIFF elevation grid geotiff-write.js
    • CivilCraft
    64-bit
  • Gravity and the foot

    The constants the simulation uses.

    g = 9.80665 m/s²; 1 ft = 0.3048 m

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    Exact
  • Grid from the surface

    Samples the ground surface into square cells in meters.

    n_x = round(W ÷ c), n_y = round(H ÷ c); c = max(W ÷ n_x, H ÷ n_y); z (m) = elevation × meters per unit

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Low spots and what they hold

    Finds each depression, its area, the volume it holds before it spills, its greatest depth and its sill level.

    filled = max(ground, lowest way out); depth = filled − ground; volume = Σ depth × cell²

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Rain depth of a storm

    The total depth of rain over the storm's duration.

    depth (mm) = Σ i × Δt ÷ 60

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Design storm by alternating blocks

    Builds a storm from an intensity-duration curve with the heaviest block in the middle.

    depth_k = idf(k·Δt) × k·Δt ÷ 60 − depth_(k−1); i_k = depth_k × 60 ÷ Δt

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Time step

    The length of each simulation step.

    dt = min(dt_max, α × Δx ÷ √(g × max(h_max, 0.01)))

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Flow across a cell face

    The unit flow between two neighboring cells for one time step.

    q = (q − g·h_f·dt·Δη ÷ Δx) ÷ (1 + g·dt·n²·|q| ÷ h_f^(7/3)); |q| ≤ h_f·√(g·h_f)

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Flow leaving at an open edge

    The unit flow out of the grid at an open edge or beside a hole in the ground.

    q = h^(5/3) × √S ÷ n, S = max(edge slope, bed slope to the cell behind); q ≤ h·√(g·h)

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Keeping depths from going negative

    Scales the outflows of a cell so it cannot give away more water than it has.

    when Σ out × dt ÷ Δx > available: out ← out × available ÷ (Σ out × dt ÷ Δx)

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • New depth, deepest water, fastest flow and first-wet time

    Updates each cell's depth and records its greatest depth, greatest speed and the time it first got wet.

    h ← h + rain − losses + (dt ÷ Δx) × (q_W − q_E + q_S − q_N); speed = |q| ÷ h

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    32-bit in part
  • Where the records are kept

    Sets up the arrays that hold the per-cell maximum depth, maximum speed and first-wet time.

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    32-bit in part
  • Drains

    Takes water out of a drain's cell up to its capacity each step.

    take = min(capacity × dt, depth × cell area)

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Volumes of rain, loss and outflow

    Adds each step's rain, losses and outflow to the running totals.

    out += Σ q × Δx × dt; rain += Σ depth of rain × cell area

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Mass balance and the results

    The stored volume, the mass balance error, the pond volumes at the end and the peak outflow.

    error = (rain − loss − out − drained − stored) ÷ rain

    Rain on the ground: overland flow, ponding and outflow rain.js
    • CivilCraft
    64-bit
  • Least-cost search

    Searches the grid for the cheapest allowed path and returns its points and total cost.

    grade = |z₂ − z₁| ÷ length ≤ limit; cost = length × unit cost × factor × (1 + w·(grade ÷ limit)²) + area × length × earth cost

    Best route across the terrain route.js
    • CivilCraft
    32-bit in part
  • Path points and their elevations

    Turns the chain of grid cells into the route's points, with the two ends at the picked points and collinear points removed.

    x = minX + (i + 0.5) × cell; collinear when |cross product| < 1e-9 × cell²

    Best route across the terrain route.js
    • CivilCraft
    32-bit in part
  • Route length, steepest grade and earthwork

    The length, steepest grade, cut and fill along a finished route.

    length = Σ √(Δx² + Δy²); grade = |Δz| ÷ l; s = |z_left − z_right| ÷ width; area = width²·s ÷ 4 ÷ max(0.05, 1 − sideSlope·s); volume += area × l ÷ n

    Best route across the terrain route.js
    • CivilCraft
    64-bit
  • Curve radius at each bend

    The turn angle and the radius implied at each bend of the route.

    turn = atan2 of the leg after − atan2 of the leg before, wrapped to (−π, π]; radius = (l₁ + l₂) ÷ (2|turn|)

    Best route across the terrain route.js
    • CivilCraft
    64-bit
  • Route profile

    Distance along the route against elevation, for the profile drawing and the point table.

    dᵢ = dᵢ₋₁ + √(Δx² + Δy²)

    Best route across the terrain route.js
    • CivilCraft
    64-bit
  • Local origin of the 3D scene

    The project point every 3D position is measured from.

    x, y = the ground surface's own origin; z = floor(lowest elevation)

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site3d.js
    • CivilCraft
    64-bit
  • Point under the pointer in 3D

    The object under the pointer and the project coordinates of the hit, shown in the 3D view's tooltip.

    X = x + origin x; Y = y + origin y; Z = z ÷ exaggeration + origin z

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site3d.js
    • CivilCraft
    32-bit in part
  • Tooltip coordinates in the 3D view

    The name of the object under the pointer with its easting, northing and elevation.

    E, N, Z to 2 decimals

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site-view3d.js
    • CivilCraft
    32-bit in part
  • Scene positions to meters, Y up

    Turns the scene's local positions into the coordinates written to GLB and OBJ files.

    x′ = x·k; y′ = (z ÷ exaggeration)·k; z′ = −y·k; k = 1200 ÷ 3937 (US survey feet) or 1

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site3d-export.js
    • CivilCraft
    32-bit in part
  • GLB position bounds

    The smallest and largest coordinate of each mesh, which a GLB file must state.

    min, max over the vertices, each passed through Math.fround

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site3d-export.js
    • CivilCraft
    32-bit in part
  • OBJ vertex text

    Writes the vertices, normals, faces, lines and points of the site as OBJ text.

    v x y z with 4 decimals (meters); vn with 5 decimals

    3D site export (GLB, OBJ, USD) and the 3D pointer readout site3d-export.js
    • CivilCraft
    32-bit in part
  • USD points and the Site transform

    Writes the site's meshes, lines and survey points to USD in meters, with the Site's transform putting them at the project coordinates.

    point = (x·k, y·k, (z ÷ exaggeration)·k) as 32-bit; Site translation = origin × k as doubles

    3D site export (GLB, OBJ, USD) and the 3D pointer readout usd-civilcraft.js
    • CivilCraft
    32-bit in part
  • Sun directions through a day

    The direction to the sun at the middle of each time step of a local day, and the hours it is above the horizon.

    minute = (k + 0.5) × step; day length = samples above the horizon × step ÷ 60

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    64-bit
  • Terrain raster for shadows

    The ground elevations on a square grid, used to test whether the ground blocks the sun.

    z[i, j] = elevation at (minX + i·cell, minY + j·cell)

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    32-bit in part
  • Ray against a building mass

    Whether the ray from a point toward the sun passes through a mass.

    t range from the mass's bottom and top; slab test on the footprint box; crossings of the sun's line with each footprint edge, inside between every other pair

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    64-bit
  • Ray against the ground

    Whether a point sees the sun: no mass in the way and no ground rising above the ray.

    march one cell at a time: x += dx, y += dy, z += rise; blocked when ground > z + 0.001

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    64-bit
  • Hours of sun per ground cell and wall point

    Adds one time step to every ground cell and wall point that is lit at each sun sample, then averages over the days.

    hours += step for each lit sample; mean = hours ÷ days; max = largest ground mean

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    32-bit in part
  • Mean hours per floor and per wall

    The mean hours of sun on each floor of each wall and on the wall as a whole.

    floor mean = Σ point hours ÷ points; wall mean = Σ floor means ÷ floors

    Hours of direct sun on the ground and on walls sunhours.js
    • CivilCraft
    64-bit
  • 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
  • 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
  • Registered position of a point

    One point in the registered frame: its stored position plus the scan's origin, moved by the scan's matrix.

    p = M × (pos + origin)

    Registered scans written as LAS and E57 scan-export.js
    • CadCraft
    • BimCraft
    32-bit in part
  • Bounds of the registered cloud

    The minimum and maximum x, y, z over every moved point, and the point count.

    Registered scans written as LAS and E57 scan-export.js
    • CadCraft
    • BimCraft
    32-bit in part

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.