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

  • 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
  • Resampling the chosen part of the photo

    Averages the chosen part of the photo down, or interpolates it up, to the tile size.

    Material maps and statistics from a photo photo-material.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Normal map from the height estimate

    The surface direction at each pixel of the tile.

    v = (−Δh_x × S, −Δh_y × S, 1) ÷ |v|, S = 4 × bump; stored as (v ÷ 2 + ½) × 255

    Material maps and statistics from a photo photo-material.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Seam ratio

    How big the jump across the tile's join is compared with the usual jump between neighboring pixels.

    ratio = mean |jump across the join| ÷ max(mean |jump between neighbors|, 1e-6)

    Material maps and statistics from a photo photo-material.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • Statistics returned with the maps

    The crop, seam ratios, mean color, height spread and mean roughness reported for the material.

    σ = √(Σ band² ÷ n); seam and σ rounded to 0.01, mean roughness to 0.001, crop to 0.001

    Material maps and statistics from a photo photo-material.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • 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
  • Normal of a tilted plane

    The unit normal of a plane from its tilt and compass bearing.

    n = (h_x·sin β, h_y·sin β, cos β), h = north·cos az + east·sin az

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Tilt and azimuth of a normal

    The tilt from horizontal and the compass bearing a plane faces.

    tilt = acos(clamp(n_z, −1, 1)); azimuth = (atan2(n·east, n·north) + 360) mod 360

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Axes of a plane from its normal

    The along-eave and up-slope directions of a roof face.

    u = (−n_y, nₓ, 0) ÷ √(nₓ² + n_y²); v = n × u

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Roof faces from triangles

    Groups upward triangles into planes and gives each plane's normal, tilt, azimuth, area and centroid.

    n = (B − A) × (C − A) ÷ |…|; area = |…| ÷ 2; face normal = unit(Σ area·n); centroid = Σ area·mid ÷ Σ area

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Point inside the face's triangles

    Tests whether a point in the face's own axes lies in any of its triangles.

    barycentric l₁, l₂, l₃ ≥ −eps ÷ √|d|

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • CivilCraft
    64-bit
  • Modules fitted in a roof face

    The positions and corners of the modules that fit inside a face with a setback.

    position = (s₀ + col × (across + gap), t₀ + row × (along + gap)); corner = centroid + s·u + t·v

    Solar array layout on roofs and ground pv.js
    • BimCraft
    • 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.