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

  • Point on a placed transition

    The project coordinates and direction at a distance along a transition element.

    p = p₀ + R(dir₀)·(x, ±y)

    Transition curves and sampled alignment geometry alignment.js
    • CivilCraft
    64-bit
  • Nearest point on a transition

    The station on a transition closest to a given point, for station and offset.

    Transition curves and sampled alignment geometry alignment.js
    • CivilCraft
    64-bit
  • Alignment as a polyline

    The alignment as vertices for linework and export: arcs and transitions become chords.

    pieces = max(1, ⌈turn ÷ maxTurn⌉, ⌈length ÷ maxSeg⌉); default maxTurn = 0.5°

    Transition curves and sampled alignment geometry alignment.js
    • CivilCraft
    64-bit
  • Transitions as straight pieces

    Each transition cut into short lines so that crossings with other linework can be found; lines and arcs are kept exact.

    pieces = max(4, ⌈θ ÷ 0.25°⌉)

    Transition curves and sampled alignment geometry alignment.js
    • CivilCraft
    64-bit
  • Meters per drawing unit

    The length of each $INSUNITS drawing unit in meters.

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    Exact
  • Drawing units to project units

    The factor every imported coordinate is multiplied by.

    inch, yard, mile into feet: meters ÷ 0.3048; metric into feet: meters ÷ (1200 ÷ 3937); into meters: meters ÷ 1

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Object coordinate system

    The rotation from an entity's own coordinate system to world coordinates, from its extrusion direction.

    Az = N ÷ |N|; Ax = (Wy or Wz) × Az, normalized; Ay = Az × Ax

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Composing transforms

    The product of two 3×4 affine transforms, used for nested block references.

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Block reference placement

    The transform of one block reference: base point, scale, array spacing, rotation, insertion point and extrusion.

    M = parent · OCS · T(insert) · R(rotation) · T(column, row) · S(scale) · T(−base)

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Arcs and circles as vertices

    Points along a circular arc, at most 5° apart.

    n = max(2, ⌈sweep ÷ 5°⌉); p = c + r·(cos a, sin a)

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Polyline bulges as vertices

    The arc between two polyline vertices that carry a bulge, as intermediate points.

    θ = 4·atan(bulge); r = chord ÷ (2·sin(θ/2)); center = chord middle + r·cos(θ/2) along the normal

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Splines as vertices

    Points along a B-spline, rational or not, sampled evenly in its parameter.

    samples = min(4000, max(16, 32 × (control points − degree)))

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Splines stored as fit points only

    A smooth curve through the fit points when the file gives no control points.

    centripetal Catmull-Rom: knot step = √(distance between points); 8 vertices per span

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Ellipses as vertices

    Points along an ellipse or elliptical arc.

    minor = ratio × (N × major); p = c + major·cos s + minor·sin s

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • One elevation per object, and flat objects

    The ELEV attribute of an imported object, and whether its vertices keep a z at all.

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Feature lines read back from a drawing

    The vertices of a feature line written earlier by CivilCraft, scaled into project units.

    x, y, z × scale

    DWG and DXF linework into project units cad-linework.js
    • CivilCraft
    64-bit
  • Survey point from a block's insertion point

    The world position of each block reference, and of each cell of an arrayed reference, in project units.

    world = OCS · insert; array cell offset rotated by the reference's rotation; × unit scale

    DWG and DXF linework into project units block-points.js
    • CivilCraft
    64-bit
  • Number from attribute text

    The elevation or number read from a block attribute such as EL 105.32.

    DWG and DXF linework into project units block-points.js
    • CivilCraft
    64-bit
  • Elevation kept for a block point

    Which elevation a point made from a block gets: the insertion z, an attribute, or none.

    DWG and DXF linework into project units block-points.js
    • CivilCraft
    64-bit
  • Number from file text

    A coordinate, angle, distance or height read from a field of the file.

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • Dotted degrees, minutes, seconds to radians

    An angle written as DDD.MMSSss, as many data collectors write it, as radians.

    angle = (D + M ÷ 60 + S ÷ 3600) × π ÷ 180

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • Degrees or gons to radians

    A file angle in decimal degrees or gons as radians.

    degrees × π ÷ 180; gons × π ÷ 200

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • GSI word to a length or angle

    The value of a GSI data word from its digits and its unit code.

    millimeters ÷ 1000; 1/10 mm ÷ 10⁴; 1/100 mm ÷ 10⁵; gon or degree counts ÷ 10⁵; sexagesimal digits split into D, M, S

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • Polar reduction

    Northing, easting and elevation of every shot from its setup.

    orientation = atan2(ΔE, ΔN) to the backsight − circle reading; hd = sd·sin(vz)·scale; N = N₀ + hd·cos(az), E = E₀ + hd·sin(az); Z = Z₀ + sd·cos(vz) + hi − hr

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • Shots as adjustment observations

    Directions and horizontal distances with their standard deviations, and starting coordinates for the free points.

    σ(direction) = 5″ = (5 ÷ 3600) × π ÷ 180; σ(distance) = 0.005

    Data collector files and polar reduction collector.js
    • CivilCraft
    64-bit
  • Section stations

    The stations at which the corridor is built.

    s = ⌈from ÷ step⌉·step, then s += step; each rounded to 6 decimals

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • Lane edge and shoulder point (simple assembly)

    The edge of pavement and the shoulder's outer edge on one side of one section, with any width or elevation target applied.

    edge z = z₀ − lane width × slope; shoulder z = edge z − shoulder width × shoulder slope

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • One side of a section from its parts

    Every point of a side from the centerline out: lanes, gutter, curb, strip, walk, then the daylight point.

    t += width; z −= width × slope (curb: z += height)

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • Where a section meets a target line

    The distance out along a section to the first crossing of a 3D polyline, and the line's elevation there.

    t = (w × d) ÷ (u × d); z = z_a + s·(z_b − z_a)

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • Do two sections cross

    Whether neighboring sections intersect, which happens inside a curve tighter than the corridor is wide.

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • Pavement course area and volume

    The plan area and the volume of each pavement course along the corridor.

    area = Σ (w₁ + w₂) ÷ 2 × Δstation; volume = area × thickness

    Corridor cross sections and pavement quantities corridor.js
    • CivilCraft
    64-bit
  • Systems the coordinates fit

    The catalog systems in which a project point falls inside the system's area of use.

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Latitude and longitude as degrees, minutes, seconds

    The status bar text for a latitude or longitude.

    seconds = round(|v| × 360000) ÷ 100, then split into D, M, S

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Latitude and longitude as decimal degrees

    The status bar text in decimal degrees.

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Typed latitude or longitude

    A typed angle, decimal or in degrees, minutes and seconds, with a sign or a hemisphere letter.

    value = ±(D + M ÷ 60 + S ÷ 3600)

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Local fit: project to grid

    Grid coordinates of a project point through a scale, rotation and shift.

    grid = to + scale · R(rotation) · (p − from)

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Misclosure of a third control point

    How far a two-point fit puts a third known point from its grid coordinates, as a distance and in parts per million.

    ppm = distance ÷ span × 10⁶

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Converting a project's coordinates

    Every stored x and y of the project (points, breaklines, boundary, alignment PIs, pads, structures) passed through a conversion.

    Coordinate system helpers crs-pick.js
    • CivilCraft
    64-bit
  • Runoff depth by curve number

    The depth of runoff from a depth of rain.

    S = 25400 ÷ CN − 254; Q = (P − 0.2S)² ÷ (P + 0.8S) for P > 0.2S

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Runoff hydrograph (triangular unit hydrograph)

    Flow against time from a catchment for a storm, with its peak and volume.

    Tp = Δt ÷ 2 + 0.6·Tc; qp = 0.208·A ÷ Tp; base = 2.67·Tp; Q(t) = Σ ΔQₖ·u(t − k·Δt)

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Runoff hydrograph (rational method)

    A trapezoid hydrograph from the rational method peak.

    Qp = C·i·A ÷ 360 (i in mm/h, A in hectares, Q in m³/s)

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Stage and storage table

    Water surface area and stored volume at each level of the pond.

    slopes: area = A₀ + P₀·m·h + π·m²·h²; storage = A₀·h + P₀·m·h² ÷ 2 + π·m²·h³ ÷ 3; table: V += h ÷ 3·(A₁ + A₂ + √(A₁·A₂))

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Storage of a low place in the ground

    Area and volume below each level inside a polygon on the ground surface.

    storage(z) = Σ cells below z of (z − ground) × cell area

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Flow through one outlet

    Discharge of an orifice, pipe, weir, spillway, V-notch or riser at a water level.

    orifice: Cd·A·√(2g·(h − D/2)); weir: Cw·(L − 0.2·n·H)·H^1.5; V-notch: (8 ÷ 15)·Cd·√(2g)·tan(θ/2)·H^2.5

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Table interpolation

    A value read from a table between two rows, used for storage, level and outflow.

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Modified Puls routing

    Storage and outflow at each time step from the inflow hydrograph.

    2S₂ ÷ Δt + O₂ = I₁ + I₂ + (2S₁ ÷ Δt − O₁)

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Pond routing results

    Peak inflow and outflow, the highest level, the greatest storage, attenuation, draw-down time and the volumes in and out.

    attenuation = 1 − peak out ÷ peak in; volume = Σ (q₁ + q₂) ÷ 2 × Δt

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Orifice diameter for a target outflow

    The orifice diameter at which the peak outflow just reaches the allowed flow.

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • Pond checks

    Overtopping, peak above the target, no attenuation, slow draw-down and a dry pond.

    Detention pond hydrology and routing detention.js
    • CivilCraft
    64-bit
  • A saved pond in project units

    Converts a saved pond to SI, runs it, and converts the results back for display.

    1 ft = 0.3048 m; 1 ft² = 0.09290304 m²; 1 acre = 4046.8564224 m²; 1 in = 25.4 mm; 1 ft³/s = 0.028316846592 m³/s

    Detention pond hydrology and routing detention.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.