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

  • Profile point added by a click

    The station and elevation of a profile point placed in the profile view.

    station = Number(sta.toFixed(2)), clamped to the alignment; z = Number(z.toFixed(2))

    Values typed or picked in the main window civilcraft.js
    • CivilCraft
    64-bit
  • Profile point moved by dragging

    The station and elevation of a profile point while it is dragged, as stored when released.

    station and z = Number(v.toFixed(2)); station kept 0.01 inside its neighbors

    Values typed or picked in the main window civilcraft.js
    • CivilCraft
    64-bit
  • Elevation of a newly drawn pad

    The elevation a new pad starts at.

    z = Number(ground(mean of corners).toFixed(1))

    Values typed or picked in the main window civilcraft.js
    • CivilCraft
    64-bit
  • Default curve radius at a new PI

    The radius given to each bend of a newly drawn alignment.

    r = min(R, ⌊half the shorter leg ÷ tan(Δ ÷ 2)⌋)

    Values typed or picked in the main window civilcraft.js
    • CivilCraft
    64-bit
  • Ground elevation at a station

    The existing ground elevation read out at the cursor's station in the profile view.

    z = z_a + (z_b − z_a) × (s − s_a) ÷ (s_b − s_a)

    Values typed or picked in the main window civilcraft.js
    • CivilCraft
    64-bit
  • Project units per file unit

    The factor that turns a spacing typed in project units into the file's own units.

    k = |f(c + d) − f(c)| ÷ d, c = middle of the file

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • Default thinning spacing

    The spacing the dialog proposes so the import stays under the point limit.

    grid: cell × ⌈√(n ÷ (0.98 × cap))⌉; LiDAR: max(1.5 × √(area ÷ points), 1.1 × √(area ÷ cap)) rounded to a 1-2-5 step

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • Points a grid import will make

    The number of cells read and of points or triangles made, shown before the import runs.

    count = ⌈columns ÷ step⌉ × ⌈rows ÷ step⌉; triangles = 2 × (⌈columns ÷ step⌉ − 1) × (⌈rows ÷ step⌉ − 1)

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • LiDAR point into project coordinates

    Each kept LiDAR point's position and elevation as stored in the project.

    (x, y) → f(x, y); z → z × z factor

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • Default GeoTIFF cell size

    The cell size proposed when a surface is exported as an elevation grid.

    cell = average triangle edge ÷ 2.5, rounded to a 1-2-5 step

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • GeoTIFF grid size estimate

    The number of columns and rows the dialog says the export will have.

    nx = ⌈width ÷ cell⌉ + 1; ny = ⌈height ÷ cell⌉ + 1

    Terrain import and GeoTIFF export settings gis-terrain-ui.js
    • CivilCraft
    64-bit
  • One slope line to the ground

    The point where a cut or fill slope leaving the pad edge meets the surface.

    f(d) = z + g·d − ground(p₀ + u·d); g = rate ÷ cut or −rate ÷ fill; find d with f(d) = 0

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Rays round the pad

    The start, direction and climb rate of every slope line: square to each edge, fanned at convex corners, along the bisector at concave corners.

    turn = atan2(n₁ × n₂, n₁ · n₂); concave rate = cos(|turn| ÷ 2); wall mitre = thickness ÷ max(0.25, cos(|turn| ÷ 2))

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Rays trimmed at a concave corner

    Drops edge rays that would reach past the line where two slopes meet in an inside corner.

    side(x, y) = b_x·(y − v_y) − b_y·(x − v_x); drop when the ray's ends have opposite signs

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Pad, slopes and daylight line as breaklines

    The lines that go into the proposed surface for one pad: its edge, its daylight line and every slope line longer than 1e-6.

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Proposed surface from ground and graded items

    Removes ground points and breaklines inside each graded region, adds the item's own, and triangulates again.

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Do two segments cross

    The yes-or-no test used for self-crossing pads, self-crossing daylight lines and breaklines that cross a region.

    o(p, q, r) = (q − p) × (r − p); cross when both pairs of signs are opposite

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Distance from a point to a polygon edge

    Whether a ground point lies on a daylight line.

    t = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); distance = |p − a − t·(b − a)|

    Pad daylight lines and the graded surface grading.js
    • CivilCraft
    64-bit
  • Cut, fill and net volume

    The volumes reported between the existing and the proposed surface.

    fill = Σ (z₁ − z₀)·c² where z₁ > z₀; cut = Σ (z₀ − z₁)·c² otherwise; net = fill − cut; area = cells × c²

    Cut and fill volumes by the grid method grading.js
    • CivilCraft
    64-bit
  • Default cell size

    Rounds the automatic cell size to 1, 2, 5 or 10 times a power of ten.

    p = 10^⌊log₁₀ v⌋; cell = {1, 2, 5, 10} × p

    Cut and fill volumes by the grid method grading.js
    • CivilCraft
    64-bit
  • Elevation of a contour line

    The one elevation a line carries: its own z, or the z all its vertices share.

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Elevations by picking lines in order

    Gives the k-th picked line the elevation start + k × interval.

    z_k = start + k × interval

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Where two contour segments cross

    The crossing point of two segments, or none when they are parallel or only meet at an end.

    d = (q − p) × (s − r); t = (r − p) × (s − r) ÷ d; point = p + t·(q − p)

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Contour checks

    Lists lines with no elevation, elevations off the interval, duplicate lines and lines that cross.

    k = (z − base) ÷ interval; off the interval when |k − round(k)| > 1e-6

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Line simplification

    Removes contour vertices that lie within a tolerance of the line through their neighbors.

    distance = |(p − a) × (b − a)| ÷ |b − a|

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Placing by two known points

    The scale, rotation and shift that take two picked points to their real positions.

    k = |b₂ − a₂| ÷ |b − a|; rot = atan2(d₂) − atan2(d₁); x′ = k·(x cos rot − y sin rot) + t_x

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Points inside flat triangles

    An estimated elevation at the centroid of each triangle whose three corners are on one contour.

    z = z₀ − (z_apex − z₀) ÷ h_n × (h ÷ 3), averaged over contour edges; limited to z₀ ± interval ÷ 2

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Building the ground surface

    Thins the points when a spacing is given, triangulates with the breaklines, and repeats the flat-triangle fill-in up to three times.

    Ground surface from contour lines and points ground-surface.js
    • CivilCraft
    64-bit
  • Catchment area

    The area of a catchment polygon in acres or hectares.

    A = |Σ (x_j + x_i)(y_j − y_i)| ÷ 2; ÷ 43560 for acres, ÷ 10000 for hectares

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Rainfall intensity

    The design rainfall intensity for a time of concentration.

    i = a ÷ (tc + b)^c

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Manning factor and gravity

    The unit factor in Manning's equation and the acceleration of gravity used for velocity head.

    k = 1 (m) or 1.486 (ft); g = 9.81 (m) or 32.174 (ft)

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Full-pipe capacity

    The flow and velocity of a circular pipe running full.

    Q = (k ÷ n) × A × R^(2/3) × √S; A = πD² ÷ 4; R = D ÷ 4

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Part-full pipe section

    The flow area, wetted perimeter and top width of a circular pipe flowing to a given depth.

    θ = 2·acos(1 − 2y ÷ D); A = D² ÷ 8 × (θ − sin θ); P = Dθ ÷ 2; T = D sin(θ ÷ 2)

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Normal depth

    The depth at which a pipe carries a given flow at its own slope.

    solve (k ÷ n) × A(y) × (A(y) ÷ P(y))^(2/3) × √S = Q for y

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Design flow in each pipe

    Accumulates C × A downstream, takes the longest time of concentration, and gives each pipe its flow.

    Q = ΣCA × i(tc) (cfs, acres); Q = ΣCA × i(tc) ÷ 360 (m³/s, hectares); travel = L ÷ V ÷ 60

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Pipe size

    The smallest standard diameter whose full-flow capacity is at least the design flow.

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Hydraulic and energy grade lines

    The water level and energy level at each end of each pipe and at each structure, from the outlet upstream.

    S_f = (Q·n ÷ (k·A·R^(2/3)))²; HGL_up = max(HGL_dn + S_f·L, invert + D) when full, else invert + y_n; h_v = V² ÷ 2g; structure = HGL_up + k_j·h_v

    Storm drainage: rational method, pipe sizing and grade lines hydro.js
    • CivilCraft
    64-bit
  • Mesh with shared vertices

    Builds a triangle mesh in which points with the same coordinates become one vertex.

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Surface area of a mesh

    The area of a corridor part or slope, as the sum of its triangles.

    area = Σ |(b − a) × (c − a)| ÷ 2

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Vertical alignment segments

    Splits a design profile into constant grades and parabolic curves, clipped to the alignment, with each segment's start elevation and grades.

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Alignment as a 3D polyline

    Samples the centerline into points with stations and design elevations.

    step = max(length ÷ 400, 1 m or 3 ft); angle limit 1°

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Corridor parts and their areas

    Joins neighboring cross sections into surfaces per part and side, and measures each surface.

    area = mesh area; length = to station − from station

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Pavement course solids

    A closed solid for each pavement course: the part's top edges lowered straight down by the depth of the course's top and bottom.

    z = z_edge − depth; depth of a course's top = Σ thickness of the courses above

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Rail cross section in project units

    The outline of a rail (head, web, foot) from its section sizes in millimeters.

    k = 0.001 (m) or 0.001 ÷ 0.3048006096 (ft); head height = 0.27 h; foot height = 0.12 h

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Rails, sleepers and ballast

    Places the rail outline on each section turned to the track's cross slope, and sets sleepers along each track at their spacing.

    o′ = o·cos(atan s) − z·sin(atan s); z′ = o·sin(atan s) + z·cos(atan s); sleeper k at distance k × spacing

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Solid orientation

    Decides whether a closed mesh's triangles face outward, and flips them if not.

    V = Σ a · (b × c); flip when V < 0

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Retaining wall solids and volume

    A closed solid for each wall run with its length, heights, face area and volume.

    volume = face area × thickness

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Pad top, slopes and area

    The pad's top surface, its cut and fill slope surfaces and its plan area.

    area = |Σ (x_i·y_j − x_j·y_i)| ÷ 2

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Superelevation event stations

    The stations at which lane slopes are written as superelevation events.

    IFC export: geometry and quantities gathered from the project ifc-civil-model.js
    • CivilCraft
    64-bit
  • Structure floor and pipe sizes

    The floor level of a manhole or inlet and the pipe diameter and plan length written for the network.

    floor = sump level, else rim − 1.5 m or rim − 5 ft; D = size ÷ 1000 or ÷ 12; L = hypot(Δx, Δy)

    IFC export: geometry and quantities gathered from the project ifc-civil-model.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.