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

  • Grid line ends read from the file

    A grid line's two ends in building millimeters, from its polyline and the grid's placement.

    world = M × (x × unit, y × unit, 0)

    Grid lines model-grids.js
    • BimCraft
    64-bit
  • Grid lines in a story's plan

    Grid line ends moved from building coordinates into one story's plan axes.

    plan = (story world)⁻¹ × point

    Grid lines model-grids.js
    • BimCraft
    64-bit
  • Boxes of the things that move

    The plan box of each wall, drawn floor, column and placed item.

    wall corners = end ± n × t ÷ 2

    Move, align and distribute model-modify.js
    • BimCraft
    64-bit
  • Align

    The move that brings each element's chosen side or middle to a common line.

    move = target − own; middle = (min + max) ÷ 2

    Move, align and distribute model-modify.js
    • BimCraft
    64-bit
  • Distribute

    The moves that space elements evenly between the first and the last.

    gap = (span − Σ sizes) ÷ (n − 1)

    Move, align and distribute model-modify.js
    • BimCraft
    64-bit
  • Where placed items stand

    The position and rotation of each placed library item in its story's plan.

    rot = atan2(M[1], M[0]) × 180 ÷ π

    Move, align and distribute model-move.js
    • BimCraft
    64-bit
  • Moving and turning placed items

    The new position and rotation of an item moved by an amount or turned, on its own or about a shared point.

    p′ = c + R(Δ) × (p − c); rot = ((rot mod 360) + 540) mod 360 − 180

    Move, align and distribute model-move.js
    • BimCraft
    64-bit
  • Rejoining wall corners after a type change

    The new corner point of two walls that met end to end, after their center lines moved.

    s = ((B.a − A.a) × v) ÷ (u × v); p = A.a + s u

    Move, align and distribute model-ops.js
    • BimCraft
    64-bit
  • Doors and windows when a wall end slides

    How far a wall's start moved along its own line, so that what it hosts keeps its place.

    shift = (B.a − A.a) · u_A; new offset = offset − shift

    Move, align and distribute model-ops.js
    • BimCraft
    64-bit
  • Fitting an opening in a wall

    The offset along the wall at which an opening of a given width fits.

    offset = max(gap, min(len − width − gap, offset))

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Sill of a door

    Whether a door stands on its wall's own level or on an upper level the wall passes.

    kept when |level elevation − base elevation − sill| ≤ 1 mm

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Offset, size and sill read back

    Where an existing door or window sits and how big it is, from the file.

    sill = M[14] + base offset; width = stored × unit

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Default offset and height check

    Where a new opening goes when no offset is given, and the check that it is not taller than the wall.

    offset = (len − W) ÷ 2; refused when sill + height > wall height + 1

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • The box that cuts the wall

    The body of the opening that is subtracted from the wall.

    box: x from 0 to width, y from −t ÷ 2 − 10 to t ÷ 2 + 10, z from 0 to height

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Width, height and area written

    The quantities and sizes written on a door or window.

    area = width × height

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Shift of a wall's start along its line

    How far a wall's start moved along the wall, so hosted openings can keep their place in the world.

    shift = (a′ − a) · u

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Door body

    The boxes a starter door is built from: frame, leaves, glass.

    frame = min(1.5 in, W ÷ 6)

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Window body

    The boxes a starter window is built from: frame, rails, stiles, glass and an optional well.

    frame = min(2 in, W ÷ 6, H ÷ 6)

    Doors and windows in walls model-openings.js
    • BimCraft
    64-bit
  • Slope and outline kind

    Turns the pitch into a slope and chooses the method for the outline.

    s = tan(pitch)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Faces of a roof over a convex outline

    Each pitched edge's face, the eave, the ridges and the area.

    keep p where (nᵢ − nⱼ) · p ≤ nᵢ · aᵢ − nⱼ · aⱼ; area = plan area × √(1 + s²)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Clipping a polygon by a half-plane

    Keeps the part of a convex polygon on one side of a line.

    t = f_a ÷ (f_a − f_b); point = a + t (b − a)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Where two offset edges meet

    The corner of the eave where two neighboring edges, pushed out by the overhang, cross.

    t = ((p₂ − p₁) × d₂) ÷ (d₁ × d₂)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Roof over an outline with square corners

    A hip roof for every largest rectangle that fits in the outline with its overhang.

    m = min(w, h) ÷ 2; ridge from (x₀ + m, c_y) to (x₁ − m, c_y)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Height of the roof over a point

    The roof's underside height above the top of the walls at a plan point.

    z = z₀ + s × (distance inside the face's eave edge)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Is the outline convex

    Chooses between the two roof methods.

    convex when every corner turns the same way

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Plan area of a polygon

    The shoelace area used for the eave and the faces.

    A = ½ Σ (xᵢ yᵢ₊₁ − yᵢ xᵢ₊₁)

    Roof planes over an outline model-roof.js
    • BimCraft
    64-bit
  • Dimension chain of a wall

    The overall length of a wall along one face and the chain of lengths between its ends and its openings.

    overall = e₁ − e₀; piece = sᵢ₊₁ − sᵢ with s rounded to 0.01 mm

    Plan view: picked points, wall outlines and dimensions model-plan.js
    • BimCraft
    64-bit
  • Wall outline with openings taken out

    The pieces of a wall's plan outline left between the openings the cut plane passes through.

    Plan view: picked points, wall outlines and dimensions model-plan.js
    • BimCraft
    64-bit
  • Clipping a polygon at a position along the wall

    Keeps the part of a polygon on one side of x = k.

    t = (k − a_x) ÷ (b_x − a_x); y = a_y + t (b_y − a_y)

    Plan view: picked points, wall outlines and dimensions model-plan.js
    • BimCraft
    64-bit
  • Viewer coordinates to a story's plan

    The matrix from the viewer's Y-up meters to a story's plan millimeters.

    M = (story world)⁻¹ × S × C⁻¹

    Plan view: picked points, wall outlines and dimensions model-plan.js
    • BimCraft
    64-bit
  • Pointer position to plan millimeters

    The plan point under the pointer, which the drawing tools then snap and use.

    x = (px − w ÷ 2) ÷ scale + cx; y = (h ÷ 2 − py) ÷ scale + cy

    Plan view: picked points, wall outlines and dimensions model-planview.js
    • BimCraft
    64-bit
  • Cutting a story's elements

    The cut segments of every element the cut plane passes through, and the edges of what lies below or above.

    Plan view of elements drawn from their mesh model-plan.js
    • BimCraft
    32-bit, display only
  • Cutting one triangle

    The segment where a triangle crosses the cut plane.

    t = (h − zᵢ) ÷ (zⱼ − zᵢ); point = pᵢ + t (pⱼ − pᵢ)

    Plan view of elements drawn from their mesh model-plan.js
    • BimCraft
    32-bit, display only
  • Joining cut segments into loops

    Closed outlines from the cut segments, for the fill.

    Plan view of elements drawn from their mesh model-plan.js
    • BimCraft
    32-bit, display only
  • Sheet and scale

    The paper size, the drawing's extent and the scale it prints at.

    fits when W ÷ r ≤ room width and H ÷ r ≤ room height

    Plan as a vector PDF model-pdf.js
    • BimCraft
    64-bit
  • Plan millimeters to the sheet

    The scale factor and offsets that place the plan on the page.

    k = 1 ÷ ratio; paper = offset + plan × k; points = paper × 72 ÷ 25.4

    Plan as a vector PDF model-pdf.js
    • BimCraft
    64-bit
  • Coordinate written to the PDF

    How a path coordinate in points is turned into text.

    text = Number(v.toFixed(6))

    Plan as a vector PDF model-pdf.js
    • BimCraft
    64-bit
  • Arcs as short lines

    Door swings and other arcs written as polylines.

    steps = max(8, ⌈|a₁ − a₀| ÷ (π ÷ 32)⌉)

    Plan as a vector PDF model-pdf.js
    • BimCraft
    64-bit
  • Rounding of a stored value

    Rounds a number to a given count of decimals before it is written to the file.

    round(v, d) = Math.round(v × 10ᵈ) ÷ 10ᵈ, d = 6 by default

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Placement position and turn

    The origin and X direction of an element's placement from a point in millimeters and an angle in degrees.

    location = round(mm ÷ unit, 6); X direction = (round(cos θ, 12), round(sin θ, 12), 0), θ = degrees × π ÷ 180

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Profile and polyline points

    A 2D point of a profile, axis or outline as it is stored.

    (round(x ÷ unit, 6), round(y ÷ unit, 6))

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Extrusion base and depth

    The start height and depth of a swept solid.

    position z = round(z₀ ÷ unit, 6); depth = round(depth ÷ unit, 6)

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Sloped placement frame

    A placement with its own Z and X directions, used for sloped parts.

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Quantity values

    Converts a length, area or volume in millimeter units to the value stored in a quantity set.

    length = round(mm ÷ unit, 6); area = round(mm² ÷ 10⁶, 6); volume = round(mm³ ÷ 10⁹, 6)

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • World matrix in millimeters

    Converts a placement matrix from file units to millimeters.

    translation × unit in mm; rotation part unchanged

    Numbers written into the IFC model model-write.js
    • BimCraft
    64-bit
  • Placement relative to a parent

    Where an element sits in the axes of its level or site.

    M = P⁻¹ × C

    Numbers written into the IFC model model-write.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.