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
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.jsExact- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
Ring area
The signed area of one polygon ring.
A = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)
Address to site: parcel area, distances and shares site-sources.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js32-bit, display only- CivilCraft
-
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.js32-bit, display only- CivilCraft
-
Road body mesh
The lanes, shoulders, curbs and walks of a corridor as triangles between neighboring sections.
3D site view scene site3d-landscape.js32-bit, display only- CivilCraft
-
Rail mesh
Each rail as a swept I-shaped outline along the track's sections.
3D site view scene site3d-rail.js32-bit, display only- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js64-bit- CivilCraft
-
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.js32-bit in part- CivilCraft
-
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.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.