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

  • Area of a written profile

    The cross-section area of an element in a written file, from its rectangle, circle or polygon.

    circle: π r²; polygon: |Σ (xₐ y_b − x_b yₐ)| ÷ 2; rectangle: w × d

    IFC 4.3 infrastructure quantities and files ifc/ifc43.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Quantities written for an element

    The length, width, height, footprint area and volume written to an element's quantity set.

    Length = longer side; Width = shorter side; GrossVolume = area × height

    IFC 4.3 infrastructure quantities and files ifc/ifc43.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Position and direction of a port

    Where a port is, in millimeters, and the way it faces.

    p = M · (0, 0, 0) × mm; z = normalize(M · (0, 0, 1) direction)

    Piping in an IFC file as PCF components ifc/pipes.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Ends and bore from the extruded body

    The two ends of a pipe segment and its bore from its extruded solid.

    a = T · 0; b = T · (direction × depth); bore = 2 × radius × mm

    Piping in an IFC file as PCF components ifc/pipes.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Turn angle of a fitting

    The angle a two-port fitting turns the pipe through.

    turn = 180 − acos(p · q) × 180 ÷ π, rounded to 2 decimals

    Piping in an IFC file as PCF components ifc/pipes.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Center point of a bend

    The corner where the axes of a bend's two ports meet.

    s = (b e − c d) ÷ (a c − b²), t = (a e − b d) ÷ (a c − b²); center = midpoint of the two closest points

    Piping in an IFC file as PCF components ifc/pipes.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Fixture units a size carries

    The fixture units a drain of a nominal size carries at a slope, as a branch or as a building drain.

    column = last listed slope ≤ slope + 10⁻⁹; capacity = table[size][column]

    Sanitary drain sizing by fixture units mep/drainage.js
    • BimCraft
    Exact
  • Smallest size that carries the load

    The first size, smallest first, that carries the fixture units and is not below the least size allowed.

    Sanitary drain sizing by fixture units mep/drainage.js
    • BimCraft
    Exact
  • Distance from a point to a run

    The shortest distance from a run's end or a fixture's connector to another run's center line.

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

    Sanitary drain sizing by fixture units mep/drainage.js
    • BimCraft
    64-bit
  • Fixture units carried by each run

    Which run each run and fixture drains into, and the total fixture units and least size of every run.

    total = own fixtures + Σ totals of the runs flowing in

    Sanitary drain sizing by fixture units mep/drainage.js
    • BimCraft
    Exact
  • Typed sizes of a piece of equipment

    Checks the values a person typed and gives the sizes the equipment is built from.

    length = round(v, 3), 10 ≤ v ≤ 20000

    MEP equipment, ports and refrigerant line sets mep/equipment.js
    • BimCraft
    64-bit
  • Equipment solids as a mesh

    Turns the boxes and cylinders of a piece of equipment into one triangle mesh.

    cylinder ring = o + u r cos a + w r sin a, a = 2π i ÷ 16; each coordinate rounded to 3 decimals

    MEP equipment, ports and refrigerant line sets mep/equipment.js
    • BimCraft
    64-bit
  • Port positions of placed equipment

    Where each port of a placed piece sits on its level and the way it faces.

    at = (x, y, z) + R(rot) · local; R turns about Z by rot × π ÷ 180

    MEP equipment, ports and refrigerant line sets mep/equipment.js
    • BimCraft
    64-bit
  • Port sizes written to the model

    The width and height stored on each port.

    stored = round(size in the file's unit)

    MEP equipment, ports and refrigerant line sets mep/equipment.js
    • BimCraft
    64-bit
  • Placement stored with the equipment

    The position and turn kept in the equipment's property set, from which it is read back and rebuilt.

    X, Y, Z = round(value, 3); Rotation = round(degrees, 6)

    MEP equipment, ports and refrigerant line sets mep/equipment.js
    • BimCraft
    64-bit
  • Line set sizes for a capacity

    The liquid and gas tube sizes for the cooling capacity a refrigerant line carries.

    row = first with capacity ≤ upTo + 10⁻⁹; beyond the table: the last row

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    Exact
  • A line set table someone typed

    Checks a custom table of capacities and tube sizes before it is used and saved.

    upTo = round(upTo × 100) ÷ 100, 0 < upTo ≤ 2000, rising

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    64-bit
  • Refrigerant tube diameter

    The outside diameter in millimeters of a refrigerant tube from its inch size.

    od = table inches × 25.4

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    64-bit
  • Route of a line between two ports

    An orthogonal path from one port to another: straight out of each, up to a common height, then across.

    points rounded to 3 decimals; common height = max of the two leads + lift + 0, 300 or 600

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    64-bit
  • Cleaning a route

    Drops repeated points and corners that go straight through.

    merge if |p − q| ≤ 0.5; straight if |d₁ · d₂ − |d₁||d₂|| < 10⁻⁶ |d₁||d₂|

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    64-bit
  • Soundness of a route

    Rejects a route that doubles back, has an inner leg shorter than 100 mm, or has a leg that is not along one axis.

    MEP equipment, ports and refrigerant line sets mep/hvac.js
    • BimCraft
    64-bit
  • Position and direction of a port read from the model

    A port's origin and the way it faces, in its level's axes in millimeters.

    at = round(M₁₂…₁₄ × 1000) ÷ 1000; out = round(z ÷ |z| × 10⁹) ÷ 10⁹

    MEP equipment, ports and refrigerant line sets mep/ports.js
    • BimCraft
    64-bit
  • Bore of a component

    The bore written for a pipe section.

    bore = nominal diameter for the pipe size, else outside diameter to 1 decimal

    PCF piping files from and to pipe runs mep/pcf-bim.js
    • BimCraft
    64-bit
  • Corner and angle of a bend

    The corner point and turn angle written for an elbow or bend.

    corner = p₀ + d₁ × R tan(θ ÷ 2); angle = θ × 180 ÷ π to 2 decimals

    PCF piping files from and to pipe runs mep/pcf-bim.js
    • BimCraft
    64-bit
  • Where two legs meet

    The corner of an imported elbow from the legs before and after it.

    s = (b e − c d) ÷ (a c − b²), t = (a e − b d) ÷ (a c − b²); corner = midpoint of the two closest points

    PCF piping files from and to pipe runs mep/pcf-bim.js
    • BimCraft
    64-bit
  • Position of a valve along a run

    The distance along an imported run to the point nearest a valve.

    s = Σ earlier leg lengths + clamp((p − a) · d, 0, L), rounded to 1 decimal

    PCF piping files from and to pipe runs mep/pcf-bim.js
    • BimCraft
    64-bit
  • Pipe size for an imported bore

    The standard nominal diameter nearest to a bore that is not a standard size.

    nearest = table value with the least |value − bore|

    PCF piping files from and to pipe runs mep/pcf-bim.js
    • BimCraft
    Exact
  • Child boxes of a node

    Stores the boxes of a node's four children as 8-bit offsets from the node's corner.

    scale = 2^e, the smallest with 255 × 2^e ≥ extent; lo = floor((box − origin) ÷ scale), hi = ceil(…)

    Ray casting for rendering and the render bench compute/bvh-wide.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Ray through the hierarchy

    Walks the hierarchy along a ray and returns the nearest hit distance.

    per axis: t = (box − origin) × (1 ÷ direction); hit if max of the near values ≤ min of the far values × (1 + 4×10⁻⁷)

    Ray casting for rendering and the render bench compute/bvh-wide.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Preview shading of a tile

    Shades each pixel of a tile from the surface it sees, lit from the eye.

    value = 0.08 + 0.72 × |n · d| ÷ |n|

    Ray casting for rendering and the render bench compute/preview-kernel.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Camera rays for one tile

    Casts the camera rays of a tile and counts the rays, the hits and the sum of the hit distances, for timing.

    direction = normalize(camera matrix · ((2 (x + jitter) ÷ W − 1) ÷ f_x, (1 − 2 (y + jitter) ÷ H) ÷ f_y, −1))

    Ray casting for rendering and the render bench compute/raycast-job.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Mean and variance from batches

    The mean picture and the variance of that mean from two or more independent batch pictures.

    mean = Σ b ÷ k; var(mean) = Σ (b − mean)² ÷ (k − 1) ÷ k

    Statistical comparison of rendered pictures compute/parity.js
    • BimCraft
    • ModelCraft
    64-bit
  • Mean and variance from sums

    The mean and the variance of the mean from per-pixel sums of the samples and of their squares.

    m = Σx ÷ n; s² = max(0, (Σx² − n m²) ÷ (n − 1)); var(mean) = s² ÷ n

    Statistical comparison of rendered pictures compute/parity.js
    • BimCraft
    • ModelCraft
    64-bit
  • Block means

    The mean of each block of pixels and the variance of that mean.

    block mean = Σ means ÷ count; block variance = Σ variances ÷ count²

    Statistical comparison of rendered pictures compute/parity.js
    • BimCraft
    • ModelCraft
    64-bit
  • Two pictures compared

    Whether a test picture agrees with a reference picture.

    z = |μ_t − μ_r| ÷ √(σ²_r + σ²_t + (10⁻⁴ max(1, |μ_r|))²); ok if failed blocks ≤ 1 % and the whole-image z ≤ 4.5

    Statistical comparison of rendered pictures compute/parity.js
    • BimCraft
    • ModelCraft
    64-bit
  • Furnace test

    Whether every block of a test picture has the expected mean within its noise.

    z = |block mean − expected| ÷ √(block variance + (10⁻⁴ max(1, |expected|))²); ok if no block has z > 4.5

    Statistical comparison of rendered pictures compute/parity.js
    • BimCraft
    • ModelCraft
    64-bit
  • Samples read from a block

    Puts the samples of one unpacked block into each channel's picture.

    half: table[16-bit value]; float: the 32-bit value; uint: the 32-bit integer

    OpenEXR and Radiance HDR picture files exr/exr.js
    • BimCraft
    • ModelCraft
    64-bit
  • Table for linear B44 channels

    The table that undoes the logarithmic step of B44 compression for channels marked linear.

    table[x] = half(8 × log(value of x))

    OpenEXR and Radiance HDR picture files exr/exr.js
    • BimCraft
    • ModelCraft
    64-bit
  • Red, green, blue and alpha of a picture

    Gathers a layer's channels into one RGBA picture.

    subsampled channel: sample at (floor(x ÷ xSampling), floor(y ÷ ySampling))

    OpenEXR and Radiance HDR picture files exr/exr.js
    • BimCraft
    • ModelCraft
    64-bit
  • Samples written to a block

    Writes each channel's samples in its type before the block is compressed.

    half: floatToHalf(v); float: nearest 32-bit float; uint: v as a 32-bit unsigned integer

    OpenEXR and Radiance HDR picture files exr/exr.js
    • BimCraft
    • ModelCraft
    64-bit
  • RGBE pixel to a number

    Turns the four bytes of a Radiance pixel into red, green and blue values.

    value = (m + 0.5) × 2^(E − 136); E = 0 gives 0

    OpenEXR and Radiance HDR picture files exr/hdr.js
    • BimCraft
    • ModelCraft
    64-bit
  • Number to an RGBE pixel

    Encodes red, green and blue values as three mantissas and a shared exponent.

    e: 2^(e−1) ≤ max(r, g, b) < 2^e; mantissa = floor(value × 256 ÷ 2^e); E = e + 128

    OpenEXR and Radiance HDR picture files exr/hdr.js
    • BimCraft
    • ModelCraft
    64-bit
  • Distance of a point along the run

    How far along the run's drawn line a point lies, measured from the first point.

    s = Σ earlier leg lengths + clamp((p − a)·d, 0, L)

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Each part's place and center-line length

    The two ends of every pipe, bend and tee along the run, and the part's own center-line length.

    bend: R × θ; tee: 2 × m; straight: |b − a|

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Where the run is cut and where spools break

    The cut positions inside straight pipe and the breaks between spools, from the field welds and the longest spool length.

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Spool length

    The parts of each spool and the spool's total center-line length.

    length = Σ part lengths, in run order

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Cut length of a straight piece

    The length of each straight pipe piece on the spool sheet's cut list.

    length = |b − a|

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Bend angle on the fitting list

    The angle shown for each elbow and the count of like fittings.

    angle = round(θ × 180 ÷ π)

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Pipe length and weight on the bill of materials

    The total cut length of pipe in a spool and its steel weight.

    kg = (kg per m) × Σ cut lengths ÷ 1000

    Pipe spools, cut lists and spool sheets mep/spools.js
    • BimCraft
    64-bit
  • Duct cut list

    How many stock-length duct pieces each straight duct needs, and the length left over.

    full = floor((L + 0.5) ÷ piece); rest = L − full × piece

    Pipe spools, cut lists and spool sheets mep/spools.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.