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

  • Convert between two units

    A value in one unit as a value in another unit of the same kind.

    result = v × (n₁ × d₂) ÷ (d₁ × n₂)

    Unit conversion unit-table.js Every app
    Exact
  • Typed text to a unit

    What was typed, with its unit, as a value in the unit the field wants.

    3 yd typed into a feet field = convert(3, yd, ft) = 9

    Unit conversion unit-table.js Every app
    Exact
  • A value to the base unit

    A number in any unit as meters, square meters, cubic meters, radians or rise over run.

    base = v × n ÷ d (v × π × n ÷ d for degrees and gons)

    Unit conversion unit-table.js Every app
    64-bit
  • A base value to a unit

    A stored base value as a number in the unit shown.

    value = base × d ÷ n (base ÷ π × d ÷ n for degrees and gons)

    Unit conversion unit-table.js Every app
    64-bit
  • Add, subtract, multiply, divide

    The four operations on values that carry units.

    a + b and a − b need the same dimensions; a × b and a ÷ b combine them

    Calc sheets calc.js Every app
    64-bit
  • Comparisons

    Pass or fail checks such as M <= 40 kN m.

    a ≤ b is true when a ≤ b + 1e-12 × max(1, |a|, |b|)

    Calc sheets calc.js Every app
    64-bit
  • Number shown

    A result as text in the sheet.

    6 significant digits; exponent form from 1e9 up and below 1e-4

    Calc sheets calc.js Every app
    64-bit
  • Knot span

    Which span of the knot vector a parameter falls in.

    i such that U[i] ≤ u < U[i + 1], by bisection

    B-spline basis functions nurbs/basis.js
    • ModelCraft
    • PartCraft
    64-bit
  • Basis functions

    The p + 1 basis functions that are not zero at a parameter.

    N(i, p)(u) by the Cox-de Boor recurrence (A2.2)

    B-spline basis functions nurbs/basis.js
    • ModelCraft
    • PartCraft
    64-bit
  • Basis function derivatives

    The basis functions and their derivatives up to a chosen order.

    N⁽ᵏ⁾(i, p)(u) for k = 0 … d (A2.3)

    B-spline basis functions nurbs/basis.js
    • ModelCraft
    • PartCraft
    64-bit
  • Inverse of a 4 × 4 matrix

    The inverse of the model's coordination matrix.

    M⁻¹ = adj(M) ÷ det(M)

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Viewer point to model point

    A camera position or a point on a section plane in the model's own coordinates, in meters with Z up.

    (x, y, z) = C⁻¹ v; IFC = (x, −z, y)

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Viewer direction to model direction

    A camera direction, up vector or section plane normal in the model's own axes.

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Model point to viewer point

    A point read from an issue file, placed in the viewer.

    v = C (x, z, −y)

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Model direction to viewer direction

    A direction read from an issue file, in the viewer's axes.

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Numbers written to the file

    How each coordinate, direction, field of view and scale is written in a viewpoint.

    round(v × 10⁶) ÷ 10⁶

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Numbers read from the file

    Reads the X, Y and Z of a point or direction.

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Camera read from a viewpoint

    The camera of an issue as BimCraft keeps it.

    Issue viewpoints in BCF files bcf.js
    • BimCraft
    • ModelCraft
    64-bit
  • Corners of a piece

    The four plan corners of a piece, or of the zone kept clear round it.

    corner = (x + u·cos r − v·sin r, y + u·sin r + v·cos r), u ∈ ±(w ÷ 2 + side), v ∈ [−front, d]

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Do two pieces overlap

    Whether two rectangles overlap by more than a hair.

    separate when, on any edge normal of either, a_max ≤ b_min + 1 mm or b_max ≤ a_min + 1 mm

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Is a point in the room

    Whether a point lies inside the room's outline.

    even-odd count of edges crossed by a ray toward +x

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Does a piece fit in the room

    Whether a rectangle lies inside the room and outside its holes.

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Which way the outline runs

    The signed area of the room's outline, used to turn it counter-clockwise.

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

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Zone kept clear at a door

    The rectangle round a door where nothing is placed.

    width = door width + 300 mm; depth = one door width on each side of the wall

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • A piece against a wall

    The first free place for a piece along a wall, with its back on the wall.

    t = w ÷ 2 + side, then every 100 mm; (x, y) = wall start + direction × t + inward normal × depth; kept: round(x), round(y), rotation to 0.001°

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • A piece in the middle of the room

    The first free place for a free-standing piece, starting at the middle of the room.

    middle of the outline's box, then offsets of k × 150 mm (k = 1…20) along ±x and ±y, at the longest wall's angle and at 90° to it

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    64-bit
  • Footprint of a placed piece

    The four plan corners of a piece from its stored position.

    Furniture layout of a room furnish.js
    • BimCraft
    • ModelCraft
    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
  • Longitude and latitude to local meters

    The position of a point in meters east and north of the address point.

    x = (lon − lon₀) × 111320 × cos(lat₀); y = (lat − lat₀) × 111320

    Site surroundings in local meters site-context.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Local meters back to longitude and latitude

    The longitude and latitude of a local point.

    lon = lon₀ + x ÷ (111320 × cos(lat₀)); lat = lat₀ + y ÷ 111320

    Site surroundings in local meters site-context.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Outlines and heights kept in the site file

    Converts each outline to local meters, thins and rounds it, and sets the item's height.

    ring = round(x × 100) ÷ 100, round(y × 100) ÷ 100; height = source height, else levels × 3

    Site surroundings in local meters site-context.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Thinning a long outline

    Reduces an outline of more than 400 points by keeping every n-th point.

    step = ⌈points ÷ 400⌉; keep indexes divisible by step

    Site surroundings in local meters site-context.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • 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

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.