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 lines an elevation shows

    The lines that run within 30° of a view's direction, and where they sit across the view.

    kept when |e · d| ÷ |e| ≥ 0.866; x = a · right

    Grid lines model-grids.js
    • BimCraft
    64-bit
  • Is the grid rectangular

    A yes or no that decides the grid's type in the file.

    parallel when |d₁ × d₂| < 1e-6; square when |u · v| < 1e-6

    Grid lines model-grids.js
    • BimCraft
    64-bit
  • 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
  • Where two face lines meet

    The point where two lines, each given by a point and a direction, cross.

    s = ((p₂ − p₁) × d₂) ÷ (d₁ × d₂); point = p₁ + s·d₁

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Nodes and tees

    Groups wall ends that meet and finds ends that land on another wall's side.

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Corner points at a node

    The mitre or corner point between each pair of neighboring walls at a node.

    c = left face of A ∩ right face of B; kept when |c − node| ≤ 4 × max(h_A, h_B) + tol

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Faces of curved walls

    Where a straight face meets a circular face, or two circular faces meet, nearest a given point.

    line and circle: t = −b ± √(b² − c); two circles: x = (d² + r₁² − r₂²) ÷ 2d, y = √(r₁² − x²)

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Curved wall outline

    The outline of a curved wall with each arc edge kept as a bulge.

    bulge = tan(sweep ÷ 4)

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Removing repeated and collinear points

    Drops outline points that repeat or lie on a straight run.

    collinear when |ab × bc| ≤ 1e-6 × (|ab|·|bc| + 1e-12) and ab·bc ≥ 0

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Signed outline area

    The signed area of an outline, used for the footprint and to check its direction.

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

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Outline validity test

    Decides whether an outline is anticlockwise and does not cross itself.

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Location line offset

    How far a wall's location line is from its center line for each justification.

    face: ± t ÷ 2; core: ± (t ÷ 2 − layer thickness up to the core face or core middle)

    Wall joins and plan outlines model-walls.js
    • BimCraft
    64-bit
  • Point along a snapped direction

    The point at an orthogonal or stepped angle from the last point, stopping at a wall it crosses or at a rounded length.

    θ = round(θ ÷ step) × step; l = len × cos(θ₀ − θ); p = from + l × (cos θ, sin θ)

    Drawn points: angle, length and wall-face paths model-tools.js
    • BimCraft
    64-bit
  • Nearest point on a wall line or face

    The point on a wall's center line or face nearest the pointer.

    s = clamp((p − a)·u, 0, L); q = a + s·u

    Drawn points: angle, length and wall-face paths model-tools.js
    • BimCraft
    64-bit
  • Signed area of a drawn loop

    The signed area of a closed chain of points, used to tell which side is outside.

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

    Drawn points: angle, length and wall-face paths model-tools.js
    • BimCraft
    64-bit
  • Center lines for a path drawn on a wall face

    Offsets a drawn path by half the wall thickness and mitres the corners.

    offset = ± t ÷ 2 along the left normal; corner = intersection of neighboring offset lines

    Drawn points: angle, length and wall-face paths model-tools.js
    • BimCraft
    64-bit
  • Where two center lines meet

    The meeting point of line a→b and line c→d, with its position along each.

    den = r × s; t = ((c − a) × s) ÷ den; u = ((c − a) × r) ÷ den; p = a + t·r

    Trim, extend and corner walls model-trim.js
    • BimCraft
    64-bit
  • New ends of a trimmed wall

    Which part of the wall stays and where its moved end goes.

    inside when 0.5 ÷ L < t < 1 − 0.5 ÷ L; click side by t_c = (click − a)·(b − a) ÷ L²

    Trim, extend and corner walls model-trim.js
    • BimCraft
    64-bit
  • Trim or extend to a wall

    A wall's new ends when it is trimmed or extended to another wall.

    allowed when −slack ≤ u ≤ 1 + slack, slack = (t_edge ÷ 2) ÷ L_edge

    Trim, extend and corner walls model-trim.js
    • BimCraft
    64-bit
  • Corner two walls

    Both walls' new ends at the point their center lines meet.

    Trim, extend and corner walls model-trim.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.