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

  • Whether a trim cuts through an opening

    Checks each door and window on the wall against the wall's new extent.

    s₀ = offset − shift, s₁ = s₀ + width; cut when the opening is not wholly outside and s₀ < −0.5 or s₁ > L + 0.5

    Trim, extend and corner walls model-trim.js
    • BimCraft
    64-bit
  • Typed length to millimeters

    Reads a typed length in feet and inches, inches with a fraction, or any unit mark, as millimeters.

    mm = sign × (|feet| × 12 + inches + n ÷ d) × 25.4

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    Exact
  • Typed point, step or polar entry

    Reads a relative step, an absolute point, a length at an angle, or a bare length from the keyboard.

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    Exact
  • Typed roof pitch to degrees

    Reads a pitch typed as a rise over a run, or in degrees.

    degrees = atan(rise ÷ run) × 180 ÷ π

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    64-bit
  • Area as text

    Formats square millimeters as m² or ft² for labels.

    m² = round(mm² ÷ 10⁴) ÷ 100; ft² = round(mm² ÷ 304.8² × 10) ÷ 10

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    64-bit
  • Pitch as text

    Formats a pitch in degrees as a rise in 12, or as degrees.

    rise = round(tan(θ) × 12 × 4) ÷ 4

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    64-bit
  • Angle as text

    Formats an angle in degrees, wrapped to 0 to 360.

    a = round(((deg mod 360) + 360) mod 360 × 10) ÷ 10

    Typed lengths, angles and pitches model-units.js
    • BimCraft
    64-bit
  • Next point from a typed entry

    The plan point for a typed absolute point, relative step, length at an angle, or length along the pointer's direction; and a door or window offset from a typed distance.

    relative: q = last + (dx, dy); polar: q = last + len × (cos θ, sin θ), θ = degrees × π ÷ 180; along the pointer: q = last + len × (to − last) ÷ |to − last|

    Typed points and door or window positions model-ui.js
    • BimCraft
    64-bit
  • Door or window position from the pointer

    The wall under the pointer and the offset of an opening centered on it.

    s = (p − a)·u; offset = s − width ÷ 2, then (L − width) ÷ 2 near the middle, else round(offset ÷ step) × step

    Typed points and door or window positions model-ui.js
    • BimCraft
    64-bit
  • Cabinet footprints in the plan

    Each counter-ready cabinet's footprint, as a rectangle or an L, in the level's plan.

    (X, Y) = (pₓ + x·cos r − y·sin r, p_y + x·sin r + y·cos r), then the level's inverse matrix

    Countertop outline and quantities res-counter.js
    • BimCraft
    64-bit
  • Countertop runs

    The outline, area and perimeter of each joined run of cabinets with the overhang added.

    front edge points += overhang × outward normal; run = union of the footprints

    Countertop outline and quantities res-counter.js
    • BimCraft
    64-bit
  • Point in a run

    Tests whether a point is inside a run's outline or on its edge.

    even-odd ray test, or within 1 mm of an edge

    Countertop outline and quantities res-counter.js
    • BimCraft
    64-bit
  • Countertop quantities

    The area, perimeter and front edge length stored for a countertop.

    Area = round(mm² ÷ 10⁶, 6) m²; FrontEdge = Σ lengths of the cabinets' front edges

    Countertop outline and quantities res-counter.js
    • BimCraft
    64-bit
  • Default dormer sizes

    The width, height, pitches, overhang and wall thickness a new dormer starts with.

    gable pitch = atan(8 ÷ 12) in degrees; shed pitch = atan(3 ÷ 12) in degrees; sizes = inches × 25.4

    Dormer geometry res-dormer.js
    • BimCraft
    64-bit
  • Dormer planes, walls and cut

    Every polygon of the dormer in 3D and the outline of the hole in the roof.

    t_v = T × √(1 + s_m²); shed: y_back = (H + t_vd) ÷ (s_m − s_d); gable: y_ridge = (H + s_d × w ÷ 2) ÷ s_m

    Dormer geometry res-dormer.js
    • BimCraft
    64-bit
  • A sloped polygon as a solid

    Sets up the frame and profile of a planar polygon swept straight up.

    n = unit((p₁ − p₀) × (p₂ − p₀)); x = unit(Z × n); y = n × x; sweep = (Z·x, Z·y, Z·n)

    Dormer geometry res-dormer.js
    • BimCraft
    64-bit
  • From the walls' level to the roof's level

    Moves the dormer's points and directions into the axes of the level that holds the roof.

    M = roof level⁻¹ × walls level; direction = M·v − M·0

    Dormer geometry res-dormer.js
    • BimCraft
    64-bit
  • Hole in the roof slab

    The outline and depth of the opening that the dormer cuts in its roof face.

    outline = M_slab · cut; depth = cutZ₁ − cutZ₀

    Dormer geometry res-dormer.js
    • BimCraft
    64-bit
  • Posts, balusters and rail length

    Places a post at each path point, spaces the balusters between posts and adds up the rail length.

    n = max(0, ⌈(clear − gap) ÷ (gap + b)⌉); s_k = post ÷ 2 + k × (clear − n × b) ÷ (n + 1) + b × (k − ½); length = Σ √(L² + Δz²)

    Railing posts, balusters and rails res-railing.js
    • BimCraft
    64-bit
  • Rail solid along a sloped segment

    Builds each rail as a square bar swept along its 3D segment.

    sweep direction = (d̂ · z, d̂_z, d̂ · x) in the frame across the rail

    Railing posts, balusters and rails res-railing.js
    • BimCraft
    64-bit
  • Railing values written to the model

    Writes the railing's path, height, base, length and counts into the model.

    Points = round(x ÷ unit, 3), round(y ÷ unit, 3); Length = round(length ÷ unit, 6)

    Railing posts, balusters and rails res-railing.js
    • BimCraft
    64-bit
  • Eave frame of a plane

    Finds the eave direction and the inward direction of a roof plane from its polygon.

    u = (p₁ − p₀) ÷ |p₁ − p₀|; n = (−u_y, u_x), flipped when Σ (p − p₀) · n < 0

    Manual roof planes res-roofplane.js
    • BimCraft
    64-bit
  • Height of the plane at a point

    The height of the plane's underside over a plan point.

    z = base + tan θ × ((p − o) · n)

    Manual roof planes res-roofplane.js
    • BimCraft
    64-bit
  • Polygon area

    The signed plan area of the plane's polygon.

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

    Manual roof planes res-roofplane.js
    • BimCraft
    64-bit
  • Sloped slab and areas written to the model

    Builds the plane's slab and writes its sloped area, projected area, points, pitch, base and thickness.

    profile y = ((p − o) · n) ÷ cos θ; depth = thickness ÷ cos θ; GrossArea = projected ÷ cos θ

    Manual roof planes res-roofplane.js
    • BimCraft
    64-bit
  • Scale that fits

    Chooses the largest standard scale at which a drawing of a given width and height fits the space on the sheet.

    first ratio with w ÷ r ≤ room_w and h ÷ r ≤ room_h; else r = ⌈max(w ÷ room_w, h ÷ room_h)⌉

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Placing a drawing in its cell

    Centers a drawing in its space on the sheet at the chosen scale and gives the mapping from drawing millimeters to sheet millimeters.

    k = 1 ÷ ratio; sheet = (x + (w − W k) ÷ 2 − x₀ k) + p × k

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • A view placed by hand on a sheet

    Works out the scale and the box of a view placed at a given point of a sheet.

    ratio = placed ratio, else the view's own, else the scale that fits a third of the sheet; box = middle ± (W ÷ ratio) ÷ 2

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Arranging the views of a sheet

    Picks one standard scale for all the drawn views of a sheet and packs them in rows.

    first ratio at which every view fits; x, y = round(middle × 10) ÷ 10

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Arcs drawn as chords

    Turns each arc of a plan symbol, such as a door swing, into a polyline for the sheet.

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

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Coordinates written to the PDF

    Formats a path coordinate for the PDF.

    text = Number(v.toFixed(6))

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Widths, text positions and matrices written to the PDF

    Formats line widths, dash lengths, clip rectangles, text sizes and the text matrix for the PDF.

    text = v.toFixed(3), with |v| < 5e-5 written as 0

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Sheet items to PDF operators

    Converts every line, fill, clip and text of a sheet from millimeters to PDF points and writes the page's drawing operators.

    points = mm × 72 ÷ 25.4

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Direction a section line looks

    The unit direction along a section line and the horizontal direction it looks.

    u = (b − a) ÷ |b − a|; look = (−u_y, u_x) or (u_y, −u_x)

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Section line written to the model

    Writes a section line's two ends, its look side and its depth into the model.

    AX, AY, BX, BY, Depth = round(value ÷ unit, 6)

    Drawing sheets to scale and the PDF res-sheets.js
    • BimCraft
    64-bit
  • Ceiling tile grid

    Lays a ceiling pattern's grid lines inside a ceiling's outline, with a tile centered on the outline's box.

    lines at c + m ÷ 2 + j × m; crossing = q_a + (q_b − q_a) × (k − p_a) ÷ (p_b − p_a)

    Drawing sheets to scale and the PDF views-model.js
    • BimCraft
    64-bit
  • Crop region of a view

    Orders the four numbers of a crop rectangle and rejects one that is not a real rectangle.

    valid when x₁ − x₀ ≥ 100 and y₁ − y₀ ≥ 100

    Drawing sheets to scale and the PDF views-model.js
    • BimCraft
    64-bit
  • View positions stored on a sheet

    Stores where each view sits on a hand-arranged sheet and at which scale.

    x, y = round(value, 2) mm; ratio = whole number

    Drawing sheets to scale and the PDF views-model.js
    • BimCraft
    64-bit
  • Another level drawn under a plan

    Moves another level's plan linework into this level's plan as plain segments.

    p′ = (T₀ x + T₄ y + T₁₂, T₁ x + T₅ y + T₁₃); arcs as 12 chords

    Drawing sheets to scale and the PDF views-model.js
    • BimCraft
    64-bit
  • Number of risers and riser height

    The number of risers a floor-to-floor height needs, each riser's height, and whether the riser, tread, width and handrail meet the limits.

    n = max(2, ⌈H ÷ riser_max − 1e-9⌉); r = H ÷ n; treads = n − 1

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Treads of a straight flight

    The plan rectangle and the height of each tread of a straight stair.

    tread i spans i × d to (i + 1) × d; z = (i + 1) × r

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Treads before and after a turn

    Divides the treads of an L, U or winder stair between the flight before the turn and the one after.

    before = max(1, min(T − turn − 1, round((T − turn) × split))); after = T − before − turn

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Landing and second flight of a U stair

    The half landing of a U stair and the treads of the flight that comes back beside the first.

    landing width = 2 w + gap; flight 2 center at ±(w + gap); z = z_landing + (j + 1) × r

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Winder treads

    Fans three winder treads from the inside corner of a quarter turn.

    outer path of length 2 w cut at 2 w k ÷ 3, k = 0 … 3

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Spiral stair

    The wedge treads of a spiral stair round its post, the handrail, the walk line and the outline.

    Δθ = tread ÷ (r_post + 12 in); tread i from θ₀ ± i Δθ; arcs chorded at ≤ 6°

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Floor-to-floor height of a stair

    The height a stair climbs: from its level to the level above, else its own fixed height.

    H = elevation_top − elevation_bottom when that is more than 100 mm

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Stairwell opening

    Finds the treads and landings that have less than the required headroom under the floor above; their outline is cut out of that floor.

    cut where z_tread + headroom > H + offset − thickness

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Center post of a spiral stair

    Builds the spiral stair's round post as a 24-sided column.

    vertices at r × (cos 2πj ÷ 24, sin 2πj ÷ 24)

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Riser and tread written to the model

    Writes the number of risers and treads, the riser height, the tread length and the required headroom.

    RiserHeight, TreadLength = round(value ÷ unit, 6)

    Stair risers, treads and stairwell res-stair.js
    • BimCraft
    64-bit
  • Stair settings written to the model

    Writes the stair's start point, angle, width, riser limit, tread, split and rail height.

    lengths = round(value ÷ unit, 6); Angle = round(angle, 6); Split = round(split, 4)

    Stair risers, treads and stairwell res-stair.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.