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.
Calculations
-
Pipe slope, cover and structure levels
Length, slope and least cover of each pipe; rim and sump of each structure; and the list of rule problems.
slope = (inv_up − inv_dn) ÷ L; crown(t) = inv_up + (inv_dn − inv_up)·t + D; cover = min over samples (ground − crown); sump = lowest invert − sump depth
Gravity pipe network: slopes, cover and automatic inverts pipes.js64-bit- CivilCraft
-
Automatic inverts
Sets each pipe's upstream and downstream inverts from the ground, the minimum cover, slope and drop.
up = min(ground − cover − D, lowest incoming invert − drop); dn = min(up − s·L, min over samples (up + (ground − cover − D − up) ÷ t))
Gravity pipe network: slopes, cover and automatic inverts pipes.js64-bit- CivilCraft
-
Rounding an invert down
Rounds a computed invert down to two decimals.
⌊v × 100 + 1e-7⌋ ÷ 100
Gravity pipe network: slopes, cover and automatic inverts pipes.js64-bit- CivilCraft
-
Bench outlines, area and perimeter
The closed outlines of the mined area at one level, each with its area and perimeter.
point = origin + index × block size; area = Σ (x_i·y_j − x_j·y_i) ÷ 2; perimeter = Σ edge lengths
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Pit floor per column
The bottom elevation of the lowest mined block in each column.
floor = origin_z + k × dz
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Overall slope with a ramp
The overall wall angle when every bench carries a ramp lane.
OSA′ = atan(H ÷ (H ÷ tan(OSA) + w))
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Outline moved inward
The bench outline moved inside by half the ramp width.
vertex shift = (n₀ + n₁) × d ÷ (1 + n₀ · n₁)
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Haul ramp route, length and drop
The ramp's 3D line down the pit, its length, its drop, and how many laps each bench needs.
run = dz ÷ grade; z = z_top − dz × min(1, walked ÷ run); length = Σ 3D segment lengths; laps = run ÷ lane perimeter
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Pit cut into the ground and volume dug
The ground surface with the pit cut in, and the volume between the ground and the pit floor.
node z = min(ground, mean of the 4 columns round it); dug = Σ max(0, ground − floor) × dx × dy
Open pit benches, haul ramp and pit surface pit-geom.js64-bit- CivilCraft
-
Depth of cut and fill by cell
The depth at every cell, the cut and fill volumes, and the deepest cut and highest fill.
dz = design − ground at ((i + 0.5)·c, (j + 0.5)·c); fill = Σ dz·c² (dz > 0); cut = Σ −dz·c² (dz ≤ 0)
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Depth classes
Equal steps of depth for shading the map, with a level band around zero.
n = ⌈depth ÷ step − 1e-9⌉; level when |dz| < step ÷ 20
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Spot levels
Ground level, design level and their difference on a grid, with the deepest cut and highest fill marked.
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Sloped pad as a plane
The elevation of each pad corner on a plane through a point, rising in a direction at a grade.
z = z₀ + grade × ((x − x₀)·cos θ + (y − y₀)·sin θ)
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Ramp strip
The four corners of a ramp between two points, its length and its grade.
L = hypot(Δx, Δy); grade = (z_b − z_a) ÷ L; corners = ends ± normal × width ÷ 2
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Free section
Ground and design cut along a polyline, with cut and fill areas and the distance of each vertex.
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Stretches of a line inside the graded regions
The distances along the section line where it runs inside a graded region.
t = ((p − a) × e) ÷ (d × e); inside tested at the middle of each piece
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Section CSV
Writes the section as distance, ground level and design level rows, then the cut and fill areas.
value = round(v × 100) ÷ 100
Cut and fill map, spot levels, sloped pads and free sections platform.js64-bit- CivilCraft
-
Plot scales
The list of scales and the millimeters on paper per project unit for each.
mm per foot = 25.4 ÷ n (1 in = n ft); mm per meter = 1000 ÷ n (1:n)
Plan sheets and plan-and-profile sheets as PDF plot.jsExact- CivilCraft
-
Scale that fits
The largest standard scale at which the drawing's extents fit the sheet.
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Drawing window in project coordinates
The part of the project that a sheet shows at a scale.
half width = frame width ÷ 2 ÷ mm per unit; window = center ± half
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Project coordinates to paper
Where each point of the plan lands on the sheet, in millimeters.
x_mm = x·s + o_x, o_x = frame middle − c_x·s
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Scale bar length
A round length about 50 mm long on paper for the scale bar.
want = 50 ÷ s; length = largest of {1, 2, 5, 10} × 10^⌊log₁₀ want⌋ not over want
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Arcs as Bézier curves
Turns a circular arc into cubic Bézier pieces for the PDF.
n = ⌈|sweep| ÷ 90° − 1e-9⌉; d = sweep ÷ n; k = 4 ÷ 3 × tan(d ÷ 4); control = end ± k·r·tangent
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
A number in the PDF
Formats every coordinate and width written to the page.
text = v.toFixed(4) with trailing zeros removed
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Millimeters to PDF points
The page transform that makes the content's units millimeters.
72 ÷ 25.4 points per millimeter
Plan sheets and plan-and-profile sheets as PDF plot.js64-bit- CivilCraft
-
Stations per sheet
The stretch of alignment each sheet shows and where each sheet starts and ends.
fits = plan window width ÷ mm per unit; length = ⌊fits ÷ round⌋ × round; sheet k starts at start + k × length
Plan sheets and plan-and-profile sheets as PDF pp-sheets.js64-bit- CivilCraft
-
Design profile points on a sheet
The stations at which the design profile is drawn within a sheet's range.
Plan sheets and plan-and-profile sheets as PDF pp-sheets.js64-bit- CivilCraft
-
Vertical exaggeration
The largest standard exaggeration (10, 5, 4, 2 or 1) at which every sheet's elevations fit the profile window.
fits when range × mm per unit × exaggeration ≤ available height; vertical scale = s × exaggeration
Plan sheets and plan-and-profile sheets as PDF pp-sheets.jsExact- CivilCraft
-
Plan turned along the alignment
Where each plan point lands on a plan-and-profile sheet, turned so the stretch runs left to right.
q = R(−θ)·(p − p_a); x_mm = x₀ + q_x·s; y_mm = c_y + (q_y − y_mid)·s
Plan sheets and plan-and-profile sheets as PDF pp-sheets.js64-bit- CivilCraft
-
Profile grid and scales
The station and elevation grid of the profile and the mapping from station and elevation to paper.
X = x₀ + (sta − a)·s; Y = y₀ + (z − z₀)·s·exaggeration; z₀ = ⌊(z_mid − span ÷ 2) ÷ step⌋ × step
Plan sheets and plan-and-profile sheets as PDF pp-sheets.js64-bit- CivilCraft
-
Vertical scale label
The vertical scale printed in the title strip.
meters: 1:round(1000 ÷ s_v); feet: 1 in = (25.4 ÷ s_v) ft to 1 decimal
Plan sheets and plan-and-profile sheets as PDF pp-sheets.js64-bit- CivilCraft
-
Volumes done, remaining and percent complete
For each survey: cut and fill done, what remains, over-cut, over-fill, stockpiles, digs and percent complete.
cut done = Σ clamp(E − A, 0, E − D)·A_cell; fill done = Σ clamp(A − E, 0, D − E)·A_cell; percent = 100 × (cut done + fill done) ÷ planned
Earthwork progress from repeat surveys progress.js64-bit- CivilCraft
-
Forecast finish date
The date the work reaches 100 percent at the pace of the last surveys.
slope = Σ (t − t̄)(p − p̄) ÷ Σ (t − t̄)²; t_end = t_last + (100 − p_last) ÷ slope
Earthwork progress from repeat surveys progress.js64-bit- CivilCraft
-
Scheduled percent on a date
The planned percent complete on a date, between the schedule's points.
p = p₀ + (p₁ − p₀) × (t − t₀) ÷ (t₁ − t₀)
Earthwork progress from repeat surveys progress.js64-bit- CivilCraft
-
Gravity and unit constants
The constants behind cant and unit conversion.
g = 9.81; km/h per mph = 1.609344; meters per foot = 1200 ÷ 3937
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Speed and length conversions
Converts a speed to km/h, a project length to meters and millimeters to project units.
km/h = mph × 1.609344; m = ft × 1200 ÷ 3937; project = mm ÷ 1000 (÷ meters per foot)
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Equilibrium cant
The cant at which a train at the design speed puts equal load on both rails.
E = G × v² ÷ (g × R), v = V ÷ 3.6
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Cant ramp shapes
How the cant rises from 0 to full along a ramp for each transition kind.
linear u; Bloss u²(3 − 2u); Helmert 2u² then 1 − 2(1 − u)²; cosine (1 − cos πu) ÷ 2; sine u − sin(2πu) ÷ 2π
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Steepest slope of each ramp shape
The factor that turns the average cant gradient of a ramp into its steepest gradient.
linear 1; Bloss 1.5; Helmert 2; cosine π ÷ 2; sine 2
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Rail heights from cant
Each rail's height above the profile for an applied cant and a pivot rule.
center: ∓E ÷ 2; inner rail fixed: 0 and E; low rail fixed: max(0, ±E)
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Cant ramp gradient and rate
The steepest cant gradient of each ramp in mm per meter and the rate of change of cant in mm per second.
gradient = |E| ÷ length (m) × peak factor; rate = gradient × v; ramp on a straight: length = |E| ÷ gradient limit
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Cant, deficiency and excess checks
Compares the applied cant, the cant deficiency and the cant excess with the limits.
deficiency = E_eq − E; excess = E − E_eq(slowest train); flagged when over the limit + 1e-9
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Cant segments along the alignment
The cant layout as constant and ramp segments, with each rail's height at both ends of each.
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Cant at a station
The applied cant and each rail's height at any station.
u = (sta − ramp start) ÷ ramp length; E = cant × g(u) on the way in, cant × (1 − g(u)) on the way out
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Track cross section
The rails, sleeper, ballast and sub-ballast outline square to the alignment, and the ballast and sub-ballast areas.
slope = (h_R − h_L) ÷ base; toe distance d = (z_shoulder − z₀ + |o|·fall) ÷ (1 ÷ ballast slope − fall)
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Area of a section polygon
The area of the ballast or sub-ballast outline in the cross section.
A = Σ (o_i·z_j − o_j·z_i) ÷ 2
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
Track quantities
Track and rail lengths, sleeper count and volume, and gross and net ballast and sub-ballast volumes.
volume = Σ (A_i + A_(i+1)) ÷ 2 × Δsta; sleepers = ⌊length ÷ spacing + 1e-9⌋ + 1; net ballast = gross − sleepers × L × W × (depth − crib)
Railway cant, cant ramps and track quantities rail.js64-bit- CivilCraft
-
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.jsExact- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
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.