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

  • Hydrograph as CSV

    Writes a structure's hydrograph as minutes and flow.

    minutes to 3 decimals; flow to 6 decimals

    Storm hydrographs routed through the pipe network storm-route.js
    • CivilCraft
    64-bit
  • Slope as typed

    Turns a typed slope (ratio, percent, degrees or vertical) into horizontal run per unit rise.

    percent: H = 100 ÷ p; degrees: H = 1 ÷ tan(a·π ÷ 180); ratio: H = h ÷ v

    Pad side slopes and retaining walls sides.js
    • CivilCraft
    64-bit
  • Wall height at each point

    The top, bottom and height of a retaining wall at each point along the pad edge.

    h = |z_pad − z_ground|; top = max; bottom = min

    Pad side slopes and retaining walls sides.js
    • CivilCraft
    64-bit
  • Wall length and face area

    The total length, face area, greatest height and average height of the walls.

    length = Σ l; face = Σ l·(h₁ + h₂) ÷ 2; average height = face ÷ length

    Pad side slopes and retaining walls sides.js
    • CivilCraft
    64-bit
  • Tall wall and steep slope checks

    Flags a wall higher than the limit and a cut or fill slope steeper than the limit.

    wall: h > limit + 1e-9; slope: H < max slope − 1e-9

    Pad side slopes and retaining walls sides.js
    • CivilCraft
    64-bit
  • Major contour test

    Decides whether a contour goes on the major layer and gets an elevation label.

    major when |z ÷ M − round(z ÷ M)| < 1e-6, M = interval × major count

    Plan drawing and section sheets for DXF and PDF scene.js
    • CivilCraft
    64-bit
  • Alignment curves as arcs

    Writes each curve of an alignment as an arc with its center, radius and start and end angles.

    a₁ = a₀ ± Δ; arc from a₀ to a₁ counterclockwise

    Plan drawing and section sheets for DXF and PDF scene.js
    • CivilCraft
    64-bit
  • Pipe line between structure walls

    Draws each pipe from the wall of one structure to the wall of the next.

    round: half = outside width ÷ 2; rectangle: half = min(L ÷ 2 ÷ |u·along|, W ÷ 2 ÷ |u·across|)

    Plan drawing and section sheets for DXF and PDF scene.js
    • CivilCraft
    64-bit
  • Scene to DXF entities

    Turns the scene's lines, arcs, points and labels into the entities the DXF writer takes.

    text height = paper mm ÷ (mm per model unit); middle-anchored text moved by height ÷ 2 across its direction

    Plan drawing and section sheets for DXF and PDF scene.js
    • CivilCraft
    64-bit
  • Section cell size and vertical exaggeration

    Sizes the cell every section is drawn in and picks the largest vertical exaggeration that fits the page.

    width = (left + right)·s + margins; height = 1.2 × largest relief × s × vex + margins; vex = the largest of 10, 5, 2, 1 not above the wanted one that fits

    Plan drawing and section sheets for DXF and PDF section-sheets.js
    • CivilCraft
    64-bit
  • Vertical scale label

    The vertical scale printed in the title strip of a section sheet.

    m: 1 : round(1000 ÷ sv); ft: 1 inch = (25.4 ÷ sv) feet, to 1 decimal

    Plan drawing and section sheets for DXF and PDF section-sheets.js
    • CivilCraft
    64-bit
  • Section points on paper

    Places each section's ground and design points, grid lines and labels in its cell.

    X = x₀ + (o + left)·s; Y = y₀ + (z − z₀)·sv; z₀ = floor((z_mid − span ÷ 2) ÷ step)·step

    Plan drawing and section sheets for DXF and PDF section-sheets.js
    • CivilCraft
    64-bit
  • Meters per unit for units found in files

    The factor for each linear unit name a LandXML file can carry.

    US survey foot = 1200 ÷ 3937 m; foot = 0.3048 m

    Typed lengths, stations and unit text units.js
    • CivilCraft
    Exact
  • One typed length

    Reads one length as typed (plain number, feet and inches, fraction, mm, cm or m) into project units.

    feet + inches ÷ 12; meter project: feet × 12 × 0.0254; feet project, metric mark: meters ÷ 0.0254 ÷ 12

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Station text

    Writes a station as text, such as 12+34.56 in feet or 1+234.567 in meters.

    r = round(|sta|, decimals); whole = floor(r ÷ station length + 1e-9); rest = r − whole × station length

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Station as typed

    Reads a station typed as 12+34.56 or as a plain number.

    value = whole × station length + rest

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Volume text

    Writes a volume in cubic yards or cubic meters, or in the volume unit chosen in Settings.

    feet: V ÷ 27 cu yd; chosen unit: V × (m per unit)³ through the shared unit table

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Area text

    Writes an area in square feet or square meters, or in the area unit chosen in Settings.

    chosen unit: A × (m per unit)² through the shared unit table

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Bearing text

    Writes a direction as a quadrant bearing in degrees, minutes and seconds.

    azimuth = (90 − a·180 ÷ π) mod 360; quadrant angle to whole seconds

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Degrees, minutes, seconds

    Splits an angle in degrees into whole degrees, minutes and seconds.

    s = round(|deg| × 3600); d = floor(s ÷ 3600); m = floor(rest ÷ 60)

    Typed lengths, stations and unit text units.js
    • CivilCraft
    64-bit
  • Search box around a point

    The longitude and latitude box that holds a radius in meters around a point.

    Δlat = r ÷ 111320; Δlon = r ÷ (111320 × max(0.01, cos lat))

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Ring area

    The signed area of one polygon ring.

    A = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Polygon area in square meters

    The area of a polygon with holes, scaled to square meters.

    A = (Σ |outer ring| − Σ |holes|) × kx × ky

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Meters per degree at the site

    The factors that turn longitude and latitude differences into meters, and the search window.

    kx = 111320 × cos(lat); ky = 111320

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Distance to each building

    The distance from the point to each building and the building's footprint area.

    d = √(((cx − x)·kx)² + ((cy − y)·ky)²), c = center of the building's bounding box

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Shares of the parcel by sampling

    The share of the parcel that lies in each zoning district, soil unit and flood zone.

    share = points in the zone ÷ points in the parcel, on a 40 × 40 grid over the parcel's bounding box

    Address to site: parcel area, distances and shares site-sources.js
    • CivilCraft
    64-bit
  • Ground mesh with elevation bands

    The triangles, normals and colors of a ground surface, cut at the elevation band levels.

    position = (x + dx, y + dy, (z − origin z) × exaggeration); normal = normalized sum of face normals

    3D site view scene site3d.js
    • CivilCraft
    32-bit, display only
  • Map picture coordinates on the ground

    Where each ground vertex falls in the map picture draped over it.

    u = (x + origin x − min x) ÷ width; v = (y + origin y − min y) ÷ height

    3D site view scene site3d.js
    • CivilCraft
    32-bit, display only
  • Road body mesh

    The lanes, shoulders, curbs and walks of a corridor as triangles between neighboring sections.

    3D site view scene site3d-landscape.js
    • CivilCraft
    32-bit, display only
  • Rail mesh

    Each rail as a swept I-shaped outline along the track's sections.

    3D site view scene site3d-rail.js
    • CivilCraft
    32-bit, display only
  • 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
  • Ground slope under a table

    The slope of the ground under one table, from a plane fitted through its sample points.

    least squares z = a + b·x + c·y on centered points; b = (Sxz·Syy − Syz·Sxy) ÷ d, c = (Syz·Sxx − Sxz·Sxy) ÷ d, d = Sxx·Syy − Sxy²

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • Table size and the shadow rule

    The width, slant length, plan depth and height of one table, and how fast the winter shadow drops behind a row.

    D = Ls·cos β; H = Ls·sin β; shadow drop per meter = tan(α) ÷ max(0.2, cos Δ)

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • One table on its piles

    Tests a table position: inside the region, off kept-out ground, not too steep, and how high its lower edge must stand.

    z₀ = max over samples of (z_ground − dq·tan β + clearance); pile = z₀ − z_ground at the lower edge; slope = atan(|gradient|)

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • Row spacing on the ground

    Steps back from each placed table to the first position where its shadow no longer reaches the next table's lower edge.

    accept when q ≥ q_top + 0.02 and z₀ ≥ z_top − (q − q_top)·tanE − 1e-6; otherwise q += step

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • Module count and installed power

    The number of modules and the installed power of the array.

    modules = tables × per row × stacked; kWp = round(modules × Wp ÷ 10) ÷ 100

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • Terrain horizon

    The highest angle of the terrain seen from a point, in each 5 degrees of bearing.

    elevation angle = max over d of atan2(z(d) − (z₀ + observer height), d)

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • Hours hidden by the horizon

    Marks the hours of the year when the sun is below the terrain horizon as fully shaded before the yield is computed.

    shaded when sun altitude < horizon elevation at round(azimuth ÷ 5) × 5 degrees

    Ground-mounted solar arrays on terrain solar.js
    • CivilCraft
    64-bit
  • 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

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.