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
-
Flow update and convergence test
Updates every link flow from the new heads and decides when the network is solved.
stop when Σ|Q_new − Q_old| ÷ Σ|Q_new| < 1e−7 and no valve or pump changed status
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Linear solve for the heads
Solves the symmetric positive definite system for the unknown node heads.
A = L·Lᵀ, forward and back substitution; or conjugate gradient with z = r ÷ diag(A)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Heads, pressures, velocities and head loss per 1000
The numbers shown for each node and pipe, converted back to project units, and the limit checks on them.
pressure = (H − z) × p factor; v = |Q| ÷ (π D² ÷ 4); loss per 1000 = |Hₐ − H_b| ÷ (L ÷ 1000)
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Available fire flow
The largest draw at one node that keeps the lowest pressure in the network at or above the residual pressure.
bisection on the draw: 40 halvings of [lo, hi], each one a full network solve
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Tank levels over time
Steps the network through the day and moves each tank level by the flow into it.
level₊ = level + inflow × Δt ÷ (π d² ÷ 4), clamped to [min level, max level]
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
EPANET-format export
Writes the network as EPANET-format text for other programs.
written value = round(v × 10⁴) ÷ 10⁴
Water mains network: heads, flows and pressures water.js64-bit- CivilCraft
-
Lot outline with arcs as chords
The lot as a counter-clockwise ring of points, each tagged with the lot line it starts.
chord angle = 2·acos(1 − 0.01 ÷ R); n = ⌈Δ ÷ chord angle⌉, 2 ≤ n ≤ 400
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Setback distance for each lot line
Assigns the front, side or rear distance, or a typed distance, to every lot line, and picks the rear line when none is named.
rear = the line with −cos(dir − front dir) > 0.5 whose midpoint is farthest from the front line's midpoint
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Buildable envelope and its area
The lot taken in from every line by that line's setback, with its area, or the reason it cannot be built.
area = |shoelace(envelope)|; lot area = |shoelace(lot ring)|
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Mitred inset with a distance per line
Moves each lot line in by its own distance and finds each new corner where two moved lines meet.
s = ((q − p) × u_q) ÷ (u_p × u_q); corner = p + s·u_p
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Allowed height under a sky-exposure plane
The lowest height the cap and the sky-exposure plane allow over a footprint.
s = ((p − a) × (b − a)) ÷ |b − a|; h = h₀ + rise × max(0, s); allowed = min over corners and lines
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Footprint area inside the envelope
How much of a building footprint lies inside the buildable envelope.
area = Σ over envelope triangles of |shoelace(footprint clipped to the triangle)|
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Clip a footprint to one triangle
The part of a polygon inside a convex, counter-clockwise piece.
side(p) = (b − a) × (p − a); crossing at u = s_p ÷ (s_p − s_q)
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Coverage, floor area ratio, setback and height checks
Compares the masses on a lot with every limit typed for it and lists each result.
coverage = Σ footprint ÷ lot area; FAR = Σ floor area ÷ lot area; outside = footprint − inside area
Zoning envelope and limit checks zoning.js64-bit- CivilCraft
-
Signed polygon area
The signed area of a closed outline.
A = −½ Σ (xⱼ + xᵢ)(yⱼ − yᵢ)
Outline minus holes: area and boundary lengths landscape/areas.js64-bit- CivilCraft
-
Point inside a polygon
Whether a point lies inside an outline, used to keep or drop each boundary piece.
count edges with (aᵧ > y) ≠ (bᵧ > y) and x < x on the edge at height y
Outline minus holes: area and boundary lengths landscape/areas.js64-bit- CivilCraft
-
Where two segments cross
The position along one edge where another edge crosses or touches it.
t = ((c − a) × s) ÷ (r × s); u = ((c − a) × r) ÷ (r × s)
Outline minus holes: area and boundary lengths landscape/areas.js64-bit- CivilCraft
-
Area by slabs
The area of the outline with every hole removed, overlaps counted once.
area = Σ over slabs of (width inside the outline and outside all holes at mid-height) × slab height
Outline minus holes: area and boundary lengths landscape/areas.js64-bit- CivilCraft
-
Outline and cut lengths
The pieces of the outline that remain and the pieces of the holes that cut it, with their total lengths.
length = Σ |b − a| over kept pieces; a = e.a + t₀(e.b − e.a), b = e.a + t₁(e.b − e.a)
Outline minus holes: area and boundary lengths landscape/areas.js64-bit- CivilCraft
-
Fingerprint of the source points
A short code that changes when the source linework moves, so the linked object knows to update.
hash of round(x × 10⁶), round(y × 10⁶) for every point
Linework checks for linked landscape objects landscape/links.js64-bit- CivilCraft
-
Clean and check a line or outline
Drops repeated points, closes an outline and refuses linework that is too short, too far away, open or self-crossing.
Linework checks for linked landscape objects landscape/links.js64-bit- CivilCraft
-
Self-crossing test
Whether any two edges of the line cross away from their ends.
Linework checks for linked landscape objects landscape/links.js64-bit- CivilCraft
-
STL reader
Turns a binary or ASCII STL file into a mesh with shared vertices, scaled to millimeters.
Freeform mesh objects: quantities and placement on the ground landscape/freeform.js64-bit- CivilCraft
-
Volume, surface area, footprint and height
The quantities of a mesh object that schedules and the IFC export report.
V = |Σ v₀·(v₁×v₂)| ÷ 6; A = Σ |(v₁−v₀)×(v₂−v₀)| ÷ 2; height = z max − z min
Freeform mesh objects: quantities and placement on the ground landscape/freeform.js64-bit- CivilCraft
-
Convex hull of the plan points
The outline used as the object's footprint on the plan.
keep a turn when (a − o) × (b − o) > 0
Freeform mesh objects: quantities and placement on the ground landscape/freeform.js64-bit- CivilCraft
-
Mesh millimeters to project coordinates
Places a mesh point on the site: scaled to project units, turned by the object's rotation and moved to its insertion point.
x = x₀ + (x·cos a − y·sin a) × k; k = 1 ÷ (1000 × meters per project unit)
Freeform mesh objects: quantities and placement on the ground landscape/freeform.js64-bit- CivilCraft
-
Base elevation and volume below ground
The elevation the object's base sits at, its points in project coordinates, and an estimate of how much of it is below the existing ground.
follow: base = lowest ground sample; cut: base = typed level or mean of the samples; below ≈ Σ (ground − base) × cell²
Freeform mesh objects: quantities and placement on the ground landscape/freeform.js64-bit- CivilCraft
-
Positions and indices from an accessor
Reads a primitive's vertex positions and triangle indices from the file's binary chunk.
Plant 3D models for the 3D view landscape/glb.js32-bit, display only- CivilCraft
-
Node transform
The 4×4 matrix of a node from its matrix, or from its translation, rotation and scale.
M = T · R(q ÷ |q|) · S
Plant 3D models for the 3D view landscape/glb.js32-bit, display only- CivilCraft
-
Transform to the model's frame, Y up to Z up
Applies each node's transform to its vertices and gathers all triangles into one mesh.
p′ = M·p; (x, y, z) → (x, −z, y)
Plant 3D models for the 3D view landscape/glb.js32-bit, display only- CivilCraft
-
Scale a model to the unit box
Centers a model in plan, sets its base at zero and scales it to one unit wide and one unit tall, with a normal per triangle.
x′ = (x − cx) ÷ w; z′ = (z − z min) ÷ h; n = (b − a) × (c − a) ÷ |…|
Plant 3D models for the 3D view landscape/symbols.js32-bit, display only- CivilCraft
-
Scale a symbol into the unit circle
Centers the symbol's entities and scales them so the farthest point is at radius 1.
x′ = round((x − cx) ÷ R × 10⁴) ÷ 10⁴
Plant symbols from SVG files and CAD blocks landscape/symbols.js64-bit- CivilCraft
-
SVG path to polylines
Reads an SVG path's commands into straight-line polylines.
Bézier point at t = k ÷ 8, k = 1 … 8
Plant symbols from SVG files and CAD blocks landscape/symbols.js64-bit- CivilCraft
-
Scale a symbol to a plant
The symbol's entities at the plant's radius on the plan.
x = x′ × R
Plant symbols from SVG files and CAD blocks landscape/symbols.js64-bit- CivilCraft
-
Corner elevations of a sloped platform
The elevation of each corner of a platform that falls at a given percent in a given direction.
z = z₀ − (pct ÷ 100) × ((x − cx)·cos a + (y − cy)·sin a)
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Mean ground elevation under an outline
The level used for a platform, berm or paving when none is typed.
mean of ground elevations at every vertex and edge midpoint
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Swale sections along a line
The bottom elevations and the left and right daylight lines of a swale, as a patch of the proposed surface.
z bottom = z start − depth − (fall ÷ 100) × s, or ground − depth, never rising; step = max(0.5 m or 1.5 ft, min(L ÷ 200, max(bottom, 1 m or 3 ft)))
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Edge of a free grading area
The outline of a grading area with ground elevations, plus the spot elevations and contours inside it.
edge spacing = √|area| ÷ 20
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Triangles and area by slope class
Sorts the surface's triangles into slope bands and totals the plan area in each.
class = number of limits the slope exceeds; area = |(b − a) × (d − a)| ÷ 2
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Ponds: depth, area and volume
Where water would stand on the surface, and each pond's depth, area, volume and spill level.
W(v) = max(Z(v), lowest level reached from the edge); volume = Σ triangle area × mean depth of its 3 corners
Landscape grading: platforms, swales, slope classes and ponding landscape/grade.js64-bit- CivilCraft
-
Length along a line
The plan length of a path, wall, curb or ramp line, and the point and direction at any distance along it.
L = Σ √(Δx² + Δy²)
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Stations along a line
The distances along a line where the ground is read and sections are built.
0, step, 2·step, … , L, and every bend; each rounded to 6 decimals
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Paving levels and falls
The elevation of each corner of a paved area for a level surface, a cross fall, or a fall to a drain.
drain: z = z₀ + (pct ÷ 100) × distance to the drain; cross: the platform plane
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Path edges and steepest grade
The center line and edges of a path on the ground, its length, and the steepest grade along it.
grade = |Δz| ÷ Δs × 100 between stations; edge z = ground ± (crossfall ÷ 100) × width ÷ 2
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Wall heights, face area and volume
The top, ground and footing level of a wall at each station, with its maximum height, face area and volume.
footing = ⌊(ground − depth) ÷ step⌋ × step; face = Σ Δs × (hₐ + h_b) ÷ 2; volume = Σ Δs × thickness × mean(top − footing)
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Ramp grade and landings
A ramp's rise, the number of runs and landings, its grade and the length it needs.
runs = ⌈rise ÷ landing interval⌉; grade = rise ÷ (L − landings × landing length) × 100; need = rise ÷ (max grade ÷ 100) + landings × landing length
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Risers, goings and run of steps
The number of risers, the riser height, the going and the run of a flight of outdoor steps.
n = ⌈H ÷ riser max⌉; riser = H ÷ n; going = max(going min, comfort − 2 × riser); run = treads × going + landings × (landing − going)
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Ground strip under a retaining wall
The two edges of the strip under a retaining wall, with the high side held at the ground or the typed top and the low side at the foot level.
high side = left when Σ (ground left − ground right) ≥ 0
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Hardscape quantities for takeoff
The areas, layer volumes and lengths of paving, paths, walls, curbs and ramps passed to TakeoffCraft.
qty = round(v × 100) ÷ 100; layer volume = area × thickness (÷ 27 for cubic yards)
Hardscape: paving, paths, walls, ramps and steps landscape/hardscape.js64-bit- CivilCraft
-
Number format in the file
Turns a number into the text written to the IFC file.
text = v.toFixed(6), trailing zeros removed
Landscape IFC export landscape/ifc-landscape.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.