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

  • Section table as CSV

    Writes station, areas, volumes and running totals to a CSV file.

    areas to 2 decimals; volumes to 1 decimal; feet projects: volume ÷ 27 (cubic yards)

    Cross sections and end-area volumes along an alignment sections.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
  • Turn angle at a point

    The signed turn of the line at a point of intersection.

    Δ = atan2 of the leg after − atan2 of the leg before, wrapped to (−π, π]

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Tangent length of each curve

    The turn and the tangent length each curve takes on either side of its point.

    T = r × tan(|Δ| ÷ 2)

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Largest radius that fits

    The largest radius at a point that fits between its neighbors' curves as they are.

    room = min(d_before − T_before, d_after − T_after); r_max = room ÷ tan(|Δ| ÷ 2)

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Overlapping curves and the fixes offered

    Finds neighboring curves whose tangents overlap and offers radii that fit.

    overlap when Tₐ + T_b > L + 1e-9; both scaled by f = L ÷ (Tₐ + T_b); offered radius = floor(r × 100 + 1e-9) ÷ 100

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Vertical curves that do not fit

    Finds vertical curves longer than the room between their neighbors and offers the longest length that fits.

    A = (g₂ − g₁) × 100; L = K × |A| when given by K; room = 2 × min(back, forward); offered L = floor(room × 100 + 1e-9) ÷ 100; K = L ÷ |A|

    Why a curve does not fit, and the radius or length that would solve-why.js
    • CivilCraft
    64-bit
  • Stations to stake

    Every multiple of the step between two stations, both ends, and the alignment's own curve points in between.

    sta = k × step for whole k; neighbors closer than 1e-6 merged

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Stake position

    The coordinates of a stake at a station and an offset to the right or left.

    x = xₚ + off × sin(dir); y = yₚ − off × cos(dir)

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Stake rows with cut or fill

    One row per station and offset with design elevation, ground elevation and cut or fill.

    cf = ground − design (positive = cut)

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Survey points against the alignment

    Each survey point's station and offset on the alignment, the design there and the cut or fill to the point's own elevation.

    cf = point elevation − design

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Staking table as CSV

    Writes the stake rows to a CSV file.

    northing, easting, design, ground and cut or fill to 3 decimals; offset and the C/F column to 2 decimals

    Staking reports staking.js
    • CivilCraft
    64-bit
  • Millimeters per project unit

    The factor from project feet or meters to millimeters.

    m: 1000; ft: 1,200,000 ÷ 3937 (US survey foot)

    Drainage structure types and their library items structs.js
    • CivilCraft
    Exact
  • Inside and outside size of a structure

    The inside and outside width and length, the wall and the frame of a structure in project units.

    inside = size ÷ P; outside = inside + 2 × wall ÷ P; P = 12 (inches per foot) or 1000 (mm per m)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Plan shapes of a type

    The outside wall, inside wall and frame opening of a type as plan shapes in millimeters.

    r = round₆((size × M) ÷ 2); M = 25.4 (inch) or 1 (mm)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Round outline as a polygon

    The outline of a round structure's body as points on a circle.

    pᵢ = (r·cos(2π·i ÷ n), r·sin(2π·i ÷ n)), n = 48

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Library item of a type

    The library item for a type: its body from the underside of the floor slab to the rim, its sizes, and every parameter in millimeters.

    H = depth × U + base × M; body = outline from −H to 0; parameters as text of (value × factor)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Type read back from a library item

    Turns a library item's millimeter parameters back into a type in the project's units.

    value = millimeters ÷ M (sizes) or ÷ U (sump, depth)

    Drainage structure types and their library items structs.js
    • CivilCraft
    64-bit
  • Length of a polyline

    The plan length of a polyline.

    L = Σ √(Δx² + Δy²)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Point at a distance along a line

    The point and direction at a distance along a polyline.

    u = (d − length before the segment) ÷ segment length, clamped to [0, 1]; p = a + (b − a)·u

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Nearest point on a line

    The distance along a polyline and the offset to the side of the point nearest to a given point.

    u = ((p − a)·(b − a)) ÷ |b − a|², clamped; d = length before + u·|b − a|; offset = ± distance, sign from the cross product

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Crossing of two segments

    Where two segments cross, as fractions along each.

    den = r × s; t = ((q − p) × s) ÷ den; u = ((q − p) × r) ÷ den

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • First crossing of two polylines

    The first place one polyline crosses another, with the distance along each.

    d_a = length before + t·|segment a|; d_b = length before + u·|segment b|

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Line square to a polyline

    A straight line square to a polyline at a distance along it, a set length to each side.

    right = (sin dir, −cos dir); p = c − right × left; q = c + right × right length

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Section along a line

    The points of the ground along a line: distance, offset, coordinates and elevation at every triangle edge crossing and line vertex.

    d = length before + t·|segment|; o = d − origin; z from the surface at (x, y)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Elevation of a section at an offset

    The elevation of a cut section at any offset, between its points.

    z = z₀ + (z₁ − z₀)·(o − o₀) ÷ (o₁ − o₀)

    Section cut from the ground along any line terrain-section.js
    • CivilCraft
    64-bit
  • Angular misclosure and leg directions

    The angular misclosure of a loop and the direction of each leg after the angles are corrected.

    misclosure = ((again − first) mod 360 + 540) mod 360 − 180; per angle = −misclosure ÷ n; az(i) = az(i − 1) + 180 + angle(i) + per angle

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Station coordinates and linear misclosure

    The unadjusted coordinates of each station, the misclosure at the end and the traverse's precision.

    x += d·cos(dir); y += d·sin(dir); misclosure = √(Δx² + Δy²); precision = total length ÷ misclosure

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Compass rule adjustment

    Moves each station against the misclosure in proportion to the distance run to reach it.

    cx = −Δx × run ÷ length; cy = −Δy × run ÷ length; adjusted = unadjusted + correction

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Traverse report as CSV

    Writes the closure and every station's unadjusted and adjusted coordinates and corrections.

    coordinates and corrections to 4 decimals; distances and length to 3; precision as 1 : whole number; angles to whole seconds

    Traverse closure and compass adjustment traverse.js
    • CivilCraft
    64-bit
  • Frog angle from the frog number

    The angle at which the diverging track leaves, from the frog number.

    θ = 2·atan(1 ÷ (2N))

    Railway turnouts, crossovers and clearance envelopes turnout.js
    • CivilCraft
    64-bit
  • Turnout radius, lead and centerline

    The closure radius, the lead and the centerline points of the diverging track.

    R = (g − s·sin β) ÷ (cos β − cos θ); lead = s·cos β + R·(sin θ − sin β); arc length = R·(θ − β)

    Railway turnouts, crossovers and clearance envelopes turnout.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.