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

  • Rounding a total

    Cuts a sum to 12 significant digits so that binary noise such as 0.1 + 0.2 does not show.

    tidy(n) = Number(n.toPrecision(12))

    Quantity totals and schedules from IFC properties ifc-qto.js
    • BimCraft
    64-bit
  • Totals by group

    Counts elements and sums the chosen number fields for each combination of group values and for the whole selection.

    sum = Σ vᵢ over the elements with a number; counted = how many had one

    Quantity totals and schedules from IFC properties ifc-qto.js
    • BimCraft
    64-bit
  • Spaces schedule totals

    The total floor area and volume of the listed rooms.

    Quantity totals and schedules from IFC properties ifc-qto.js
    • BimCraft
    64-bit
  • Is a property value the same in both versions

    Decides whether a number or text property changed between two versions of a model.

    same when |a − b| ≤ 1e-9 × max(1, |a|, |b|)

    Quantity totals and schedules from IFC properties ifc-compare.js
    • BimCraft
    64-bit
  • Number shown in Properties

    How a property or quantity value from the file is written out in the Properties panel.

    shown = round(x × 10⁴) ÷ 10⁴

    Quantity totals and schedules from IFC properties ifc-model.js
    • BimCraft
    64-bit
  • Placement of an item relative to its story

    The location and X direction written to the file for a placed item.

    (lx, ly) = W⁻¹ × (x ÷ unit, y ÷ unit, story z); direction = W⁻¹ rotation × (cos r, sin r)

    Placing and pasting elements in an IFC model ifc-place.js
    • BimCraft
    64-bit
  • Position and rotation read back from a placement

    The x, y and rotation of each placed item as listed in the equipment schedule and used by copy and paste.

    x = W[12] × unit; y = W[13] × unit; rot = round(atan2(W[1], W[0]) in degrees × 1000) ÷ 1000

    Placing and pasting elements in an IFC model ifc-place.js
    • BimCraft
    64-bit
  • An item's body in the file's unit

    Writes a library item's mesh or box as IFC geometry in the file's length unit.

    coordinate in file units = millimeters ÷ (millimeters per file unit)

    Placing and pasting elements in an IFC model ifc-place.js
    • BimCraft
    64-bit
  • Plan outline as polylines

    Turns the lines, arcs, circles, ellipses and bulged polylines of an item's plan into the straight segments written as its footprint.

    arc: n = max(4, ⌈sweep ÷ 10°⌉) segments; bulge: θ = 4 atan(b), r = chord ÷ (2 sin(θ ÷ 2))

    Placing and pasting elements in an IFC model ifc-place.js
    • BimCraft
    64-bit
  • Viewer point to model millimeters and back

    Converts a point between the viewer's Y-up meters and the model's Z-up millimeters.

    model = (x × 1000, −z × 1000, y × 1000) of C⁻¹ × v; viewer = C × (x ÷ 1000, z ÷ 1000, −y ÷ 1000)

    Placing and pasting elements in an IFC model ifc-place.js
    • BimCraft
    64-bit
  • Move and turn of pasted elements

    The matrix that carries copied elements to where they are pasted, with a turn about a point and a change of story.

    M = T(about + d) × Rz(rot) × T(−about); dz = elevation of target story − elevation of source story

    Placing and pasting elements in an IFC model ifc-elements.js
    • BimCraft
    64-bit
  • Placement written for a pasted element

    The location, Z axis and X axis of the new placement, from its matrix.

    location = round to 6 decimals; axis = column ÷ its length, rounded to 9 decimals

    Placing and pasting elements in an IFC model ifc-elements.js
    • BimCraft
    64-bit
  • Wall faces in plan

    The two long faces of each wall as plan segments in model millimeters, with a normal pointing away from the wall.

    Wall faces and plan frames from element meshes ifc-place.js
    • BimCraft
    32-bit in part
  • Smallest rectangle round a wall's plan points

    The minimum-area bounding rectangle of a set of plan points.

    for each hull edge direction u: area = (max u − min u) × (max v − min v); keep the smallest

    Wall faces and plan frames from element meshes ifc-place.js
    • BimCraft
    64-bit
  • Snapping an item to the nearest wall face

    The position and rotation that put an item's back against the nearest wall face.

    t = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); q = a + t (b − a); position = q + n × maxY; rot = atan2(−n_y, −n_x) − 90°

    Wall faces and plan frames from element meshes ifc-place.js
    • BimCraft
    32-bit in part
  • Plan frame of copied elements

    The turn of the first copied element and the box of all copied meshes measured in those turned axes.

    rot = atan2(W[1], W[0]) in degrees, rounded to 6 decimals; box from orientedBox

    Wall faces and plan frames from element meshes ifc-place.js
    • BimCraft
    32-bit in part
  • Box of points in turned plan axes

    The bounds of a point list in plan axes turned by an angle, and the box center in model millimeters.

    u = x cos r + y sin r; v = −x sin r + y cos r; center = ((u₀ + u₁) ÷ 2, (v₀ + v₁) ÷ 2) turned back

    Wall faces and plan frames from element meshes ifc-place.js
    • BimCraft
    64-bit
  • Is this mesh a straight prism

    Checks that the mesh is closed and consistently wound, and picks candidate directions for the prism's axis.

    eps = tol × bounding-box diagonal, tol = 1e-6

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Depth, frame and outline of the prism

    The prism's depth, its origin and axes, and its outline and holes in the cap's own two axes.

    h = v · n; depth = max h − min h; (u, v) = ((p − origin) · x, (p − origin) · y)

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Removing collinear outline points

    Drops outline corners that lie on the line between their neighbors.

    drop b when |(b − a) × (c − b)| ≤ tol × max(1, |c − a|)

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Volume of a closed mesh

    The signed volume of a closed triangle mesh, used to check a conversion.

    V = Σ A · (B × C) ÷ 6

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Area of the prism's outline

    The outline's area less its holes; times the depth it is the prism's volume.

    area = |shoelace(outer)| − Σ |shoelace(hole)|

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Writing the prism into the file

    The IFC lines of the outline, its placement and the extrusion depth.

    each number written as toFixed(6)

    Turning a face mesh back into an extrusion ifc-solids.js
    • BimCraft
    64-bit
  • Degrees from degrees, minutes, seconds and millionths

    Reads an IFC compound angle as decimal degrees.

    deg = d + m ÷ 60 + (s + μ ÷ 10⁶) ÷ 3600

    Where an IFC model point is on the earth ifc-geo.js
    • BimCraft
    64-bit
  • File point to map grid

    Easting, northing and height in meters of a point of the file.

    [E, N, H] = (matrix × p) × meters per map unit

    Where an IFC model point is on the earth ifc-geo.js
    • BimCraft
    64-bit
  • Longitude and latitude from the site's reference point

    An approximate WGS 84 position of a file point from its offset east and north of the site's point.

    w = √(1 − e² sin² φ); N = a ÷ w; M = a (1 − e²) ÷ w³; lon = lon₀ + east ÷ ((N + h) cos φ); lat = lat₀ + north ÷ (M + h)

    Where an IFC model point is on the earth ifc-geo.js
    • BimCraft
    64-bit
  • Degrees to degrees, minutes and seconds

    Formats a latitude or longitude with its hemisphere letter.

    d = ⌊|deg|⌋; m = ⌊(|deg| − d) × 60⌋; s = (|deg| − d − m ÷ 60) × 3600, shown with 2 decimals

    Where an IFC model point is on the earth ifc-geo.js
    • BimCraft
    64-bit
  • Viewer point to the file's own coordinates

    Takes a point picked in the viewer back to the file's Z-up coordinates in its own length unit.

    y = C⁻¹ × (place⁻¹ × p); file = (y_x, −y_z, y_y) ÷ meters per file unit

    Where an IFC model point is on the earth ifc-geo.js
    • BimCraft
    64-bit
  • Feature edges of one element

    The edges of an element where its faces meet at more than the feature angle, plus its free edges.

    edge drawn when n₁ · n₂ ≤ cos(angle), or when only one triangle uses it

    Element outlines in the IFC view ifc-vis.js
    • BimCraft
    32-bit, display only
  • Edge segments of a batch

    Collects every element's edges into one array of line segments with a run per element.

    Element outlines in the IFC view ifc-vis.js
    • BimCraft
    32-bit, display only
  • Section of a run

    The outside diameter, wall and bend radius of a pipe from the size table, or the width and height of a duct, in millimeters.

    mm = inches × 25.4

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Run corners with the slope applied

    The corners of a run with its fall along the horizontal length from the first point.

    z = z₀ − slope × Σ horizontal leg length

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Bend radius of an elbow

    The center-line radius an elbow is built with.

    pipe: the table's radius; round duct: 1.5 × diameter; rectangular duct: its width for a turn in plan, its height for a turn up or down

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Elbow geometry at a corner

    The two tangent points, center and angle of the elbow where a run turns.

    θ = acos(d₁ · d₂); T = R × tan(θ ÷ 2); center = p₀ + n × R

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Where runs meet

    Finds run ends that touch another run's end or lie on another run's line, to make an elbow, reducer or tee there.

    end to end when |P − Q| ≤ max(tol_a, tol_b); tee when the foot of P on a leg is within the tolerance

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Elbow, reducer and tee allowances

    How much of each leg an elbow, a reducer or a tee takes.

    reducer length (duct) = max(150, max(|Δw|, |Δh|) ÷ 2 ÷ tan 15°); tee half length = max(25, 0.5 × branch + 0.25 × host)

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Straight pieces between fittings

    The start and end of every straight piece along each leg, after trims, tees, valves and weld cuts.

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Saving a run's definition

    The points, sizes, slope and flow kept in the run's property set.

    point = round to 3 decimals of a millimeter

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Length and surface written on each piece

    The length of a straight pipe or duct piece and a duct's outside surface, written as IFC quantities.

    L = |b − a|; perimeter = π w (round), π h + 2 (w − h) (oval), 2 (w + h) (rectangle); surface = perimeter × L

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Elbow written as a revolved section

    The axis and angle of the solid of revolution that an elbow is written as.

    axis at R to the side of the section; angle = θ

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Flat-oval outline

    The outline of a flat-oval duct with semicircular ends.

    r = H ÷ 2; c = W ÷ 2 − r; points at c + r cos a, r sin a

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Position along a run

    How far along a run a plan point lies, and how far off the line.

    t = clamp((p − a) · d, 0, L); s = Σ earlier legs + t

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Length of a run

    The length of a run's center line through its corners, with the slope applied.

    L = Σ |Vᵢ − Vᵢ₋₁|

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Pipe size for a flow and a velocity limit

    The smallest pipe of a material and class whose velocity stays at or under the limit.

    V = Q ÷ (π D² ÷ 4); first size with V ≤ V_max

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Duct size for a flow

    A duct sized by equal friction, returned in millimeters.

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Drain sizes by fixture units

    The smallest drain size that carries the fixture units reaching each sanitary run, never smaller than what flows into it.

    grow when needed nominal > drawn nominal + 1e-9

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Pipe and duct schedules

    Total length and piece count per pipe size, and length and surface per duct size.

    length = Σ stored piece lengths; surface = Σ perimeter × length

    Pipe and duct runs: layout, lengths and sizing mep-model.js
    • BimCraft
    64-bit
  • Friction rate of a round duct at the velocity limit

    The pressure drop per meter used to propose a duct size when the calculation ran by velocity.

    D = √(4 Q ÷ (π v)); rate = 0.02 × (1.204 ÷ D) × v² ÷ 2

    Pipe and duct runs: layout, lengths and sizing mep-calc.js
    • BimCraft
    64-bit
  • Proposed duct sizes

    The width and height proposed for each duct run that is too small or too fast.

    size for the largest flow in the run, rounded to 1 mm

    Pipe and duct runs: layout, lengths and sizing mep-calc.js
    • BimCraft
    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.