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

  • Stair from a sketched walking line

    Turns a walking line of one, two or three segments into a straight, L or U stair: its direction, width, gap, split and tread depth.

    n = max(2, ⌈H ÷ riser_max − 1e-9⌉); tread = max(50, line length ÷ (n − 1)); split = first leg ÷ total

    Stair risers, treads and stairwell stair-sketch.js
    • BimCraft
    64-bit
  • Roof plane area in Properties

    The sloped area of a manual roof plane shown in its properties.

    area = |½ Σ (xᵢ yᵢ₊₁ − yᵢ xᵢ₊₁)| ÷ cos θ

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Cut list schedule

    The lumber schedule's rows: size, stock length, pieces and board feet, with totals.

    board feet shown = bf.toFixed(1)

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Board feet of a framing in Properties

    Shows the piece count and board feet of one framing.

    shown = Math.round(BoardFeet)

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Cut and fill in Properties

    Shows the terrain's cut and fill volumes.

    shown = V.toFixed(1) m³

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Direction and height of a new stair

    The direction a new stair runs, from its start point to the pointer, and the height it climbs.

    angle = atan2(Δy, Δx) × 180 ÷ π; height = elevation above − elevation here

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Building width on an elevation (fallback)

    The overall width of the building across a view direction, used for the width note on an elevation when the wall-based width is not available.

    x = q · r ± t ÷ 2 over every wall end; width from min to max

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Inverse of a level's placement

    Inverts a level's 4×4 world matrix to bring site coordinates back into the level's plan.

    R⁻¹ = Rᵀ; t⁻¹ = −Rᵀ t

    Figures shown in the residential panels and schedules res-ui.js
    • BimCraft
    64-bit
  • Local origin and merging of points

    Moves every point to a local origin and makes points that fall on the same spot one vertex.

    origin = ⌊min x⌋, ⌊min y⌋; key = round(x ÷ 1e-4), round(y ÷ 1e-4)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Coordinates handed to the triangulator

    Packs the local coordinates for Delaunator and runs the Delaunay triangulation.

    coords = (x, −y) per vertex

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Boundary clipped to the data and given elevations

    Clips the outer boundary to the convex hull of the data and takes each corner's elevation from a first surface built without it.

    z_corner = elevationAt(x, y) with a 1e-6 edge tolerance

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Triangles kept inside the boundary

    Drops the triangles whose center lies outside the boundary.

    keep when the centroid (Σx ÷ 3, Σy ÷ 3) is inside the boundary polygon

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Surface from given triangles

    Builds a surface from vertices and faces read from a file, keeping every triangle counter-clockwise.

    o = (x_b − x_a)(y_c − y_a) − (y_b − y_a)(x_c − x_a); swap b, c when o < 0

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Crossing of two breakline segments

    Finds where two segments properly cross, as a fraction along each.

    t = cross(c − a, s) ÷ cross(r, s); u = cross(c − a, r) ÷ cross(r, s)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Vertex at a breakline crossing

    Places a new vertex where two breaklines cross and gives it an elevation.

    x = x_a + (x_b − x_a) t; z from the first breakline

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Side of a breakline a vertex is on

    Decides whether a vertex lies left of, right of, or on the line of a breakline being forced in.

    on the line when |orient| ÷ L < 1e-7 × (1 + L)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Whether a diagonal can be flipped

    Tests that the two triangles on an edge form a strictly convex quadrilateral.

    orient(c, d, a) and orient(c, d, b) have opposite signs

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    Exact
  • Whether an edge crosses a breakline

    Tests whether two segments properly cross during the flips that force a breakline in.

    each segment's ends lie on opposite sides of the other

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    Exact
  • Long outer triangles removed

    Removes triangles on the outside whose outer edge is longer than a limit, working inward.

    remove when outer edge length > maxEdge

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Contour lines

    The contour lines of the surface at every multiple of an interval.

    level = base + k × interval; t = (L − zᵢ) ÷ (zⱼ − zᵢ); point = pᵢ + (pⱼ − pᵢ) t

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Triangle clipped at an elevation

    Keeps the part of a triangle above or below a level, for the elevation bands.

    t = f_p ÷ (f_p − f_q); new point = p + (q − p) t at z = L

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Convex hull

    The convex hull of a set of points, counter-clockwise.

    monotone chain; pop while cross(o, a, b) ≤ 0

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Polygon area

    The signed area of a polygon.

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

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Point inside a polygon

    Tests whether a point is inside a polygon.

    count crossings of a ray to the right; odd = inside

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Polygon clipped by a convex polygon

    Clips a polygon to a convex polygon, used to keep a boundary inside the data's hull.

    inside when cross(b − a, p − a) ≥ −1e-9; t = cross(a − p, e) ÷ cross(d, e)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Polygon clipped at a station or an offset

    Cuts a wall outline at an opening's edge or at a layer boundary.

    t = (at − a) ÷ (b − a); new point has the clip coordinate exactly

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Layer bands across a wall in plan

    The band of each wall layer across the wall, from the exterior face inward.

    off₀ = ±t ÷ 2; offᵢ₊₁ = offᵢ ∓ tᵢ

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Layer thicknesses against the wall thickness

    Checks that a wall's layers add up to its thickness before any layer is drawn.

    |Σ tᵢ − t| ≤ 0.005 mm

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Curved wall outlines as chords

    Maps a path from the wall's frame back to the plan, adding points along a curved wall so the chords stay close to the arc.

    step = 2 acos(max(−1, 1 − 0.002 ÷ radius)); n = ⌈|Δstation| ÷ R ÷ step⌉

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Boundary lines between layers

    Finds the stretches of a layer boundary that lie inside the wall's outline.

    x = x_a + (x_b − x_a) × (offset − y_a) ÷ (y_b − y_a)

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Outline of joined wall pieces

    Finds the outer edges of wall pieces that touch, so shared edges inside a joint are not drawn.

    t = cross(c − a, v) ÷ cross(d, v); parallel when |cross(d, v)| < 1e-12 × |d| × |v|

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Building width on an elevation

    The overall width of the building's walls across a view direction, for the width note on an elevation.

    x = p · right ± |n · right| × t ÷ 2 over every wall end

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Wall and opening edges for an elevation

    The edges of a straight wall's two faces, its ends and its openings, handed to the hidden-line view.

    P(s, t, h) = a + u s + n t at height h

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Walls of every level in one level's axes

    Moves every wall and opening into one level's plan and height, for a section through several levels.

    T = inverse(level) × level_wall; a′ = T a; z = T₁₄ + base offset

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Where a section cuts a wall

    The station along a wall at which the section plane cuts it, when the cut is square to the wall.

    s = ((o − a) · dir) ÷ (u · dir)

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Layer bands in a section cut

    The rectangle of each wall layer in a section, between the heights the openings leave.

    x = c + off × (n · right); offᵢ₊₁ = offᵢ ∓ tᵢ

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Corners of an item

    The four corners in plan of an item of given width, depth, position and turn.

    corner = (x₀ + x cos a − y sin a, y₀ + x sin a + y cos a), a = rot × π ÷ 180

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Access strips

    The strips beside each side of an item that must stay free, as turned rectangles.

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Overlap of two convex polygons

    Whether two items, or an item and an access strip or obstacle, overlap by more than a sliver.

    separated if maxA ≤ minB + tol or maxB ≤ minA + tol on any edge normal; tol = 1

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Distance from a point to a segment

    The shortest distance from a corner of one item to an edge of another.

    t = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |p − (a + t (b − a))|

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Gap between two items

    The least distance between two items that do not overlap, compared with the minimum aisle width.

    gap = min over corners and edges of the point-to-segment distance

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Floor load of an item

    The weight of an item divided by its footprint area, compared with the floor load limit.

    load = weight ÷ (area ÷ 10⁶) in kg per m²; area = |Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)| ÷ 2

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Footprint of Plant equipment

    The width, depth, height and center of a piece of Plant equipment for the layout, from its bounding box.

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Flow path length

    The length of the path through a sequence of items, measured center to center along X then Y.

    L = Σ (|Δx| + |Δy|)

    Factory layout checks addons/plant/lib/layout.js
    • BimCraft
    64-bit
  • Openings and walls on a room's edge

    Finds the doors, windows and walls that lie on the outline of a room.

    t = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |p − a − t (b − a)|; on the edge if d ≤ tolerance

    Rooms handed to add-ons with their doors, windows and walls addons/bimcraft-api.js
    • BimCraft
    64-bit
  • SI value of a file unit

    Meters per file length unit and radians per file angle unit.

    SI unit: 10^prefix; conversion-based unit: factor × factor of its base unit; by name: degree π ÷ 180, inch 0.0254, foot 0.3048

    IFC units and placements ifc/geo-ctx.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Axis placement as a matrix

    The matrix of an IfcAxis2Placement3D, 2D or IfcAxis1Placement.

    columns = (x, z × x, z, origin), x = reference direction projected square to z

    IFC units and placements ifc/geo-ctx.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • First projection axis

    The X axis of a placement: the reference direction projected into the plane normal to Z.

    x = normalize(v − z (v · z))

    IFC units and placements ifc/geo-ctx.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Cartesian transformation operator

    The matrix of an IfcCartesianTransformationOperator, uniform or not, in 2D or 3D.

    columns = (x s₁, y s₂, z s₃, origin)

    IFC units and placements ifc/geo-ctx.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • World matrix of a placement

    The position of an element in the model from its chain of relative placements.

    world = parent world × local

    IFC units and placements ifc/geo-ctx.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    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.