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

  • Page scale matrix

    The matrix that lets the rest of the page be written in millimeters.

    [K 0 0 K 0 0] with K written as num(K) = 2.8346

    Vector PDF output pdf.js
    • BimCraft
    • DetailCraft
    64-bit
  • Page size in points

    The page box from the sheet size in millimeters.

    points = num(mm × K)

    Vector PDF output pdf.js
    • BimCraft
    • DetailCraft
    64-bit
  • Circle as four curves

    A circle written as four cubic Bézier curves.

    control distance k = 0.5522847498 × r

    Vector PDF output pdf.js
    • BimCraft
    • DetailCraft
    64-bit
  • Text position and matrix

    Where a text starts and how it is turned and sized.

    x = x₀ + dx·cos θ, y = y₀ + dx·sin θ; matrix = [h·cos θ, h·sin θ, −h·sin θ, h·cos θ, x, y]

    Vector PDF output pdf.js
    • BimCraft
    • DetailCraft
    64-bit
  • Room grid

    Covers a room with square cells and marks the ones whose center is inside it.

    cell × 1.5 while (W ÷ cell + 1) × (H ÷ cell + 1) > 60000

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Distance field over a room

    The walked distance from one cell to every other free cell of a room.

    d(n) = min over 16 neighbors of d(c) + √(Δi² + Δj²) × cell

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Route between two places in a room

    The distance in meters between two points of a room and the path walked.

    straight: √(Δx² + Δy²) ÷ 1000; else Σ segment lengths of the string-pulled path ÷ 1000

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Distance to the goal from every opening

    The remaining walking distance to an exit, or to a room, from each side of each door and stair.

    d(far side of j) = min(d(i) + walk(j → i) + length of opening j)

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Travel distance of each room

    The farthest point of each room from an exit, in meters along the walls.

    max over cells and corners of min over openings (distance to opening + distance beyond it); rounded to 0.01 m

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Speed factor from crowd density

    How much the crowd in a room slows a walker.

    D = people ÷ max(area, 0.5); factor = 1 for D ≤ 0.54, else max(min factor, (1 − 0.266·D) ÷ (1 − 0.266 × 0.54))

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Flow rate of an opening

    How many people per second a door or stair lets through.

    rate = flow per meter × max(0.2, width ÷ 1000 − 2 × boundary)

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Walking step

    How far a walker moves in one time step and the distance added to their total.

    Δs = v₀ × factor × Δt; walked += min(Δs, remaining length of the leg)

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Passing an opening

    The moment each queued person passes a door or stair, and their wait.

    pass = max(next free, arrival, t) + counter-flow penalty; next free = pass + 1 ÷ rate; wait = pass − arrival

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Reported times and distances

    Total time, median and 90th percentile times, walked distances and waits.

    percentile p = times[ceil(n·p) − 1]; times rounded to 0.1 s, distances to 0.01 m

    People movement and travel distance people-sim.js
    • BimCraft
    64-bit
  • Stair length

    The walked length of a stair from its plan walk line and its height.

    length = √(plan length² + height²)

    People movement and travel distance people-model.js
    • BimCraft
    64-bit
  • People per room

    How many people each room holds before a run.

    count = floor(area in m² ÷ m² per person)

    People movement and travel distance people-model.js
    • BimCraft
    64-bit
  • Rounding of stored picture values

    Rounds a position, scale or angle to 6 decimals.

    r6(v) = Math.round(v × 10⁶) ÷ 10⁶

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • New picture record

    The cleaned numbers of a picture, with defaults.

    default scale = r6(20000 ÷ width in pixels); angle = r6(((a mod 360) + 360) mod 360)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Scale by two points and a distance

    The new scale and center that make two picked points a given distance apart.

    k = mm ÷ |b − a|; scale′ = r6(scale × k); center′ = r6(a + (center − a) × k)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Corners of a placed picture

    The four corners of the picture in plan millimeters.

    corner = center + R(θ) · (± w·scale ÷ 2, ± h·scale ÷ 2), θ = angle × π ÷ 180

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Pixel to plan matrix

    The transform from picture pixels to plan millimeters.

    [k·c, k·s, k·s, −k·c, x + k(−w/2·c − h/2·s), y + k(−w/2·s + h/2·c)]

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Plan point to picture pixel

    The pixel of the picture under a plan point.

    (u, v) = (R(−θ)·(q − center)) ÷ scale; pixel = (u + w ÷ 2, h ÷ 2 − v)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Picture on a vertical plane

    Puts a picture on the plane standing over a line, as wide as the line.

    k = L ÷ w; center = (L ÷ 2, h·k ÷ 2)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Picture width typed

    The scale that makes the picture a typed width.

    scale = r6(mm ÷ w)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Turning a picture

    The new angle after a turn about the picture's center.

    angle′ = r6(((angle + deg) mod 360 + 360) mod 360)

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Fit in a box

    Centers an unscaled picture in the view at 90 % of the box.

    k = min(box width ÷ w, box height ÷ h) × 0.9

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Corners in 3D

    The picture's corners in level coordinates, for a level or a vertical plane.

    p = origin + u·û + v·v̂

    Picture backgrounds: scale, placement and print picture.js
    • BimCraft
    64-bit
  • Vertical picture in an elevation or section

    Decides whether a standing picture shows in a view and gives its matrix there.

    shown when |û·dir| ≤ sin(2°) and, in a section, |(a − o)·dir| ≤ 100 mm; x = a·right ± picture x, y = level difference + picture y

    Picture backgrounds: scale, placement and print picture-sheet.js
    • BimCraft
    64-bit
  • Number format for picture matrices

    Turns a matrix entry or opacity into the text written in the PDF.

    toFixed(6), trailing zeros removed; |v| < 5e-7 → 0

    Picture backgrounds: scale, placement and print picture-pdf.js
    • BimCraft
    64-bit
  • Pixels to print a picture at

    The pixel size a picture is drawn at on a sheet, limited by dots per inch and total pixels.

    paper mm per pixel = scale ÷ ratio; dpi = 25.4 ÷ that; k = min(1, max dpi ÷ dpi, √(max pixels ÷ (w·h)))

    Picture backgrounds: scale, placement and print picture-pdf.js
    • BimCraft
    64-bit
  • Matrix for the image's unit square

    Turns the pixel-to-plan matrix into the one PDF needs for an image drawn on a unit square.

    [a·w, b·w, −c·h, −d·h, e + c·h, f + d·h]

    Picture backgrounds: scale, placement and print picture-pdf.js
    • BimCraft
    64-bit
  • Scale from two points and a distance

    How many millimeters one page unit is, from two picked points and the true distance between them.

    scale = distance in mm ÷ √(Δx² + Δy²)

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Circle through three points

    The center and radius of the circle through three points.

    d = 2(p_x(q_y − r_y) + q_x(r_y − p_y) + r_x(p_y − q_y)); center from the squared lengths ÷ d

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Arc from a Bézier curve

    Recognizes a cubic curve that is a circular arc and gives its center, radius, start angle and sweep.

    circle through P(0), P(0.5), P(1); accepted when |dist(P(t), center) − r| ≤ 0.012 r at t = 0.25 and 0.75

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Page lines and arcs in millimeters

    Scales a PDF page's line segments and arcs to millimeters and finds their bounds.

    x_mm = x_pt × mm per point

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Scan lines and arcs in millimeters

    Scales a traced scan from pixels to millimeters and turns its y axis up.

    x = px × k; y = (height in px − py) × k

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Joining lines cut at a tee

    Merges lines of one straight run that are split by a joining wall.

    merged when |cos angle| ≥ cos 1.2°, both ends within 35 mm of the first line, and the gap ≤ 350 mm

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Hatching detection

    Finds bundles of short parallel lines so they are not taken for walls.

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Merged wall line and thickness

    The center line and thickness of a wall made of collinear pieces with openings between them.

    t = Σ tᵢ·Lᵢ ÷ Σ Lᵢ; offset = Σ offsetᵢ·Lᵢ ÷ Σ Lᵢ; A, B = base + u·s + n·offset

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Squaring a scanned page

    Decides whether a scan is turned back before it is traced.

    turned by the found angle when |angle| > 0.15° and confidence > 1.6

    Walls and openings from PDF pages and scans plan-pages.js
    • BimCraft
    64-bit
  • Stored position and angle

    The X, Y and Angle written for a symbol.

    X, Y = round(mm ÷ unit, 6); Angle = round(radians × 180 ÷ π, 4)

    Plan symbol positions plan-symbols.js
    • BimCraft
    64-bit
  • Point on a wall face

    The point on a wall's face at a distance along the wall, and the direction the face looks.

    at = a + s·u + side × (t ÷ 2)·n; face angle = atan2(side·n_y, side·nₓ)

    Plan symbol positions plan-symbols.js
    • BimCraft
    64-bit
  • Symbols following a wall

    Moves a symbol to where its stored side and distance are on the wall now.

    turn = atan2(sin Δ, cos Δ), Δ = new face angle − stored face angle

    Plan symbol positions plan-symbols.js
    • BimCraft
    64-bit
  • Program totals

    The net and gross floor area and the number of rooms in the program.

    net = Σ count × area; gross = net ÷ efficiency

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • Rectangle inside the envelope

    Tests whether a turned rectangle lies inside the envelope.

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • Rectangle of a wanted area

    The rectangle of a given proportion and area nearest the middle of the envelope.

    short = √(area ÷ ratio); long = short × ratio

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • L and U shapes of a wanted area

    An L-shaped or U-shaped footprint scaled to the wanted area and placed in the envelope.

    k = √(wanted area ÷ template area)

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • Rooms stacked on floors

    Assigns rooms to floors up to each floor's usable area.

    placed when floor net + room area ≤ usable area + 1e-6

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • Areas reported for an option

    Footprint, gross area, required area, surplus and coverage of one massing option.

    footprint = |shoelace|; gross = footprint × floors ÷ 10⁶; surplus = gross − required; coverage = footprint ÷ envelope area

    Massing options from a room program program-mass.js
    • BimCraft
    64-bit
  • Option handed to the site study

    The option's points and floor height in the project's units.

    x = mm × unit per mm

    Massing options from a room program program-mass.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.