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

  • Closest points of two lines

    The nearest points between two infinite lines, or nothing when they are parallel.

    den = A·C − B²; parallel when |den| < 1e-14 × A × C

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Ray and plane

    The point where a ray's line meets a plane.

    t = (d_plane − n·o) ÷ (n·dir); p = o + t × dir

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Ray and triangle

    The distance along a ray to a triangle, or nothing when it misses.

    Möller–Trumbore: det = e₁·(d × e₂); u, v, t from three scalar triple products ÷ det

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Rotation about an axis through a point

    The 4×4 matrix that turns geometry by an angle about an axis through a given point.

    M = T(about) × R(axis, θ) × T(−about), R from Rodrigues' formula

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Transform a point

    A point moved by a 4×4 matrix.

    p′ = (M × [x, y, z, 1]) ÷ w

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Inverse of a 4×4 matrix

    The matrix that undoes a transform, used to move points into a group's own coordinates.

    M⁻¹ = adj(M) ÷ det(M), with det from twelve 2×2 minors

    3D vectors, planes and transforms m3d/vec.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • One typed length to meters

    Text such as 10'-6 1/2", 3/4", 320cm or a bare number, as meters.

    m = sign × (feet × 0.3048 + (inches + num ÷ den) × 0.0254); m = sign × value × factor(suffix or model unit)

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Meters per unit

    The factor that turns a bare number in the model's unit into meters.

    in = 0.0254; ft = 0.3048; yd = 0.9144; mi = 1609.344; mil = 0.0254 ÷ 1000

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Arithmetic over typed lengths

    A typed expression such as 12'6"+3/4" or 2*450mm as one length in meters.

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • The value box

    What was typed as a length, a list of lengths, a point, an offset, a count or a plain number for angles and factors.

    plain number = value in meters ÷ meters per unit (for arithmetic and bare fractions)

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Length readout

    A length in meters as text in the model's unit.

    ft-in: total = round(m ÷ 0.0254 × den) sixteenths (or the chosen fraction); others: toFixed with the unit's decimals

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Inches as a fraction

    Inches written as a whole number and a reduced fraction.

    sx = round(inches × den); whole = ⌊sx ÷ den⌋; fraction = (sx mod den) ÷ den, reduced by the greatest common divisor

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Area readout

    An area in square meters as text in the model's unit.

    ft²: a ÷ (0.3048 × 0.3048); in²: a ÷ (0.0254 × 0.0254); mm model: m² from 0.01 m², else mm²

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Volume readout

    A volume in cubic meters as text in the model's unit.

    ft³: v ÷ 0.3048³; in³: v ÷ 0.0254³; mm model: m³ from 0.01 m³, else mm³

    Typed lengths and length readouts in 3D m3d/units.js
    • CadCraft
    • ModelCraft
    64-bit
  • Two-point arc from its bulge

    The radius, center and sweep of an arc through two points that stands off the chord by a given bulge.

    R = (h² + (c ÷ 2)²) ÷ (2|h|); center = midpoint + side × sign(h) × (|h| − R); sweep = 4 × atan(2|h| ÷ c)

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Sweep of an arc drawn from its center

    The angle from the arc's start direction to the pointer, counter-clockwise about the plane normal.

    a = atan2((u × w)·n, u·w), plus 2π when a ≤ 0; snapped to k × π ÷ 12 when within 0.03 rad

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Rectangle width and height

    The two sides of a rectangle from its first corner to the pointer, along the plane's two axes.

    w = (q − p₀)·u; h = (q − p₀)·v

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Distance from a point to an outline segment

    How far the pointer is from one side of the outline being offset, in the outline's plane.

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

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Offset distance and side

    The signed distance an outline is offset by: the least distance to any side, positive into a face.

    d = ± min over sides of distance(p, side); inside by an even-odd crossing count

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point inside an outline

    Whether the pointer lies inside a face's outline, which decides if an offset goes inward or outward.

    count the sides whose ends straddle the point's height and cross to its right; inside when the count is odd

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Push/pull distance

    The distance a face is pushed, in the open group's own scale, and the distance reported back.

    kernel distance = d × k; reported d = returned distance ÷ k; k = |normal taken into the group's axes|

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Move and copy

    The translation applied to the selection, in the open group's own coordinates.

    local delta = M⁻¹ × delta (direction only); transform = T(local delta)

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Rows and rings of copies

    The transform of each copy when a copy is repeated (3x) or divided (/3).

    copy k: T(k × delta) or R(k × angle); divided: k ÷ n of the delta or angle

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Rotation angle

    The angle the selection is turned by, from the reference direction to the pointer.

    a = atan2((ref × v)·n, ref·v); snapped to k × π ÷ 12 when within 2.5°

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Uniform scale factor

    The factor the selection is scaled by about a fixed point, from a reference point to the pointer.

    f = max(0.001, ((p − base)·u) ÷ (u·u)), u = ref − base

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Stretch by a grip

    The matrix that scales the selection by separate factors along the group's three axes about an anchor.

    M = T(a) × diag(fx, fy, fz) × T(−a)

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Guide line offset from an edge

    The perpendicular offset of a new guide line from the edge or guide it was measured from.

    w = w₀ − dir × (w₀·dir), w₀ = pointer − start

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Guide direction at an angle

    The direction of a guide line at a given angle from the protractor's zero direction.

    d = normalize(u × cos a + (n × u) × sin a)

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Dimension line offset

    Where the dimension line sits: the pointer's offset square to the measured line.

    off = q − ab × (q·ab), q = pointer on the plane − first point, ab = unit direction of the measured line

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Terrain brush weights

    How much each terrain point under the round brush is raised or lowered.

    w = 0.5 × (1 + cos(π × d ÷ R)) for d < R; new z = z + w × Δz

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Selection bounding box

    The box around the selection in world coordinates; its middle is the center for turning and scaling from the keyboard.

    min and max per axis over the transformed points; center = (min + max) × 0.5

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Frame of a placed component

    The three axis directions a component gets when it is laid on a face.

    z = face normal toward the eye; x = red axis less its part along z (or blue × z); y = z × x

    3D drawing and editing tools m3d/tools.js
    • CadCraft
    • ModelCraft
    64-bit
  • Temperature form of the parameters

    The interaction parameter of each pair at a temperature.

    pᵢⱼ = aᵢⱼ + bᵢⱼ ÷ T; 0 on the diagonal

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • NRTL

    ln γ of every component by the NRTL model.

    ln γᵢ = Cᵢ ÷ Sᵢ + Σⱼ xⱼ Gᵢⱼ ÷ Sⱼ × (τᵢⱼ − Cⱼ ÷ Sⱼ), Gᵢⱼ = exp(−αᵢⱼ τᵢⱼ), Sⱼ = Σ xₖ Gₖⱼ, Cⱼ = Σ xₘ τₘⱼ Gₘⱼ

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • Wilson

    ln γ of every component by the Wilson model.

    ln γᵢ = 1 − ln(Σⱼ xⱼ Λᵢⱼ) − Σₖ xₖ Λₖᵢ ÷ Σⱼ xⱼ Λₖⱼ

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • UNIQUAC

    ln γ of every component by the UNIQUAC model.

    ln γᵢ = ln(φᵢ÷xᵢ) + z⁄2 qᵢ ln(θᵢ÷φᵢ) + lᵢ − φᵢ÷xᵢ Σ xⱼlⱼ + qᵢ (1 − ln Σ θⱼτⱼᵢ − Σ θⱼτᵢⱼ ÷ Σ θₖτₖⱼ)

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • Infinite-dilution limits

    The closed-form ln γ of each component of a binary when it is infinitely dilute.

    NRTL: ln γ₁^∞ = τ₂₁ + τ₁₂ exp(−α τ₁₂); Wilson: ln γ₁^∞ = 1 − ln Λ₁₂ − Λ₂₁

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • Henry's constant at temperature

    Henry's constant of a dissolved gas in pascals at a temperature.

    H(T) = H₂₉₈ (bar) × 1e5 × exp(slope × (1 ÷ T − 1 ÷ 298.15))

    Activity coefficients and Henry's law process/activity.js
    • CadCraft
    • BimCraft
    64-bit
  • Stream segments from enthalpies

    A process stream with phase change as a list of pieces with constant heat capacity flow rate.

    12 equal temperature steps; CP = |F (H_k − H_{k−1}) ÷ (T_k − T_{k−1})|

    Pinch analysis process/pinch.js
    • CadCraft
    • BimCraft
    64-bit
  • Problem table

    The minimum hot and cold utility and the pinch temperature for a minimum approach.

    shift hot streams by −ΔT_min⁄2 and cold by +ΔT_min⁄2; net_k = Σ (±CP)(T_hi − T_lo); Q_H = −min of the running sum; Q_C = last running sum + Q_H

    Pinch analysis process/pinch.js
    • CadCraft
    • BimCraft
    64-bit
  • Composite curves

    The hot and cold composite curves as lists of enthalpy and temperature points.

    H_{k+1} = H_k + (Σ CP of the streams present) × (T_{k+1} − T_k); cold curve shifted by Q_C

    Pinch analysis process/pinch.js
    • CadCraft
    • BimCraft
    64-bit
  • Area target

    The minimum heat-exchange area for the composite curves with vertical heat transfer.

    A = Σ_intervals (Σ_streams CPᵢ ΔTᵢ ÷ hᵢ) ÷ ΔT_lm, ΔT_lm = (d₀ − d₁) ÷ ln(d₀ ÷ d₁)

    Pinch analysis process/pinch.js
    • CadCraft
    • BimCraft
    64-bit
  • Minimum number of units

    The fewest exchangers, heaters and coolers for maximum energy recovery.

    above the pinch: streams + (1 if Q_H > 1e-9) − 1; below: streams + (1 if Q_C > 1e-9) − 1

    Pinch analysis process/pinch.js
    • CadCraft
    • BimCraft
    64-bit
  • Results table lines

    A result object as a flat list of named values for the calculator's table.

    number → +v.toPrecision(6); list of numbers → count, first and last to 5 digits

    Calculator results and export process/calc.js
    • CadCraft
    • BimCraft
    64-bit
  • CSV export of the results

    The results table as comma-separated text.

    Calculator results and export process/calc.js
    • CadCraft
    • BimCraft
    64-bit
  • Figure for the status bar

    The yearly emissions, installed cost or campaign length a run adds to the running totals.

    value = Number(the results line with that name)

    Calculator results and export process/calc.js
    • CadCraft
    • BimCraft
    64-bit
  • Molecular dynamics set-up

    The lattice spacing, cell count and cutoff of the Lennard-Jones liquid calculator.

    a = ∛(4 ÷ ρ); n = min(max(2 | n_typed, 2), 6); r_c = min(2.5, n a ÷ 2 − 1e-6)

    Calculator results and export process/calc.js
    • CadCraft
    • BimCraft
    64-bit
  • Column outlet compositions

    The outlet flows and mole fractions the column calculator lists.

    zᵢ → +zᵢ.toPrecision(5)

    Calculator results and export process/calc4.js
    • CadCraft
    • BimCraft
    64-bit
  • Pump power and suction head margin

    The hydraulic power of a pump and the margin between the available and required net positive suction head.

    power = ρ g Q H ÷ η; NPSH_r by straight-line interpolation between the maker's points; margin = NPSH_a − NPSH_r

    Calculator results and export process/calc4.js
    • CadCraft
    • BimCraft
    64-bit
  • Mesh energy against the plain sum

    The relative difference between the particle-mesh and plain Ewald reciprocal energies.

    |E_mesh − E_plain| ÷ |E_plain|

    Calculator results and export process/calc4.js
    • CadCraft
    • 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.