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

  • Unit changes on reading

    Standard Surface values converted to the app's units.

    thin film thickness ÷ 1000; emission ÷ 0.02; opacity = (r + g + b) ÷ 3

    MaterialX files: numbers written and read shading/mtlx.js
    • BimCraft
    • ModelCraft
    64-bit
  • Tile size from uvtiling

    The material's tile size in meters from the uvtiling shared by a file's images.

    width = 1 ÷ tiling_u; height = 1 ÷ tiling_v

    MaterialX files: numbers written and read shading/mtlx.js
    • BimCraft
    • ModelCraft
    64-bit
  • Mean of an input that varies over the tile

    The single value given to a shader input the renderers and the file cannot vary across the surface.

    mean = Σ f(uᵢ, vⱼ) ÷ 64², a 64 × 64 grid of texel centers

    MaterialX files: numbers written and read shading/bake.js
    • BimCraft
    • ModelCraft
    64-bit
  • abs, round, ceil and floor

    The four functions an expression may call.

    round(x) = floor(x + 0.5) for x ≥ 0, −floor(−x + 0.5) for x < 0; ceil(x) = ⌈x − 1e-9·max(1, |x|)⌉; floor(x) = ⌊x + 1e-9·max(1, |x|)⌋

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Adding and subtracting

    Sums and differences of lengths, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Multiplying and dividing

    Products and quotients of a length and plain numbers, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • The answer

    The final value and whether it is a length or a plain number.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Unit sizes

    Builds each unit's row: its fraction of the base unit and the factor used for quick conversion.

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

    Unit table: reading and writing values unit-table.js Every app
    Exact
  • Numbers and fractions

    Reads 6, 6.5, 6 1/2, 6-1/2 or 1/2 as a number.

    whole + numerator ÷ denominator

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Feet and inches

    Reads 12'6", 12'-6 1/2" or 6" as inches.

    inches = feet × 12 + inches

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Degrees, minutes and seconds

    Reads 45°30'15" or 45d30m15s as degrees.

    degrees + minutes ÷ 60 + seconds ÷ 3600

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Slopes

    Reads 2%, 3H:1V, 1:3 or 6/12 as a grade (rise over run).

    percent ÷ 100; H:V → V ÷ H; rise:run → rise ÷ run

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing feet and inches

    Writes a length as feet, inches and a fraction of an inch.

    n = round(|inches| × den); feet = ⌊n ÷ 12den⌋; inches = ⌊rest ÷ den⌋; fraction = rest ÷ den, reduced

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing degrees, minutes and seconds

    Writes an angle as degrees, minutes and seconds.

    t = round(|degrees| × 3600 × 10^dec); split by 3600 and 60

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing decimals

    Writes a number with a fixed count of decimals.

    text = v.toFixed(dec)

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Unit vector

    A direction scaled to length 1, or nothing when it has no length.

    l = √(x² + y² + z²); l > 1e-300 → (x, y, z) ÷ l

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Plane

    A point of a plane from its (u, v), and back.

    P = O + U·u + V·v; u = (p − O)·U; v = (p − O)·V

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Cone and cylinder

    A point of a cone or cylinder (circular or elliptical base) from its angle and its height along the axis, and back.

    t = ± sin ÷ cos; q = 1 + h·t ÷ R; P = C + X·R·q·cos u + Y·R_m·q·sin u + N·h; u = atan2((d·Y) ÷ R_m, (d·X) ÷ R); apex at h = −R ÷ t

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Sphere

    A point of a sphere from longitude and latitude, and back.

    P = C + r·cos v·(X·cos u + Y·sin u) + Z·r·sin v; u = atan2(y, x); v = atan2(z, √(x² + y²))

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Torus

    A point of a torus from its two angles, and back.

    w = A + B·cos v; P = C + X·w·cos u + Y·w·sin u + N·B·sin v; u = atan2(y, x); v = atan2(z, √(x² + y²) − A)

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline surface and its inverse

    A point of a B-spline surface from (u, v), its normal, and the (u, v) nearest to a given point.

    first guess: nearest of 25 × 25 samples; then Gauss–Newton on |p − S(u, v)|² with partial derivatives by central differences of 1e-6 of the range

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Knot span

    Which knot interval a parameter falls in.

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • De Boor evaluation

    A point of a B-spline at a parameter, in homogeneous coordinates.

    a = (t − Uᵢ) ÷ (Uᵢ₊ₚ₋ᵣ₊₁ − Uᵢ); d_j = (1 − a)·d_j₋₁ + a·d_j

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline curve point

    A point of a rational B-spline curve.

    P = (X, Y, Z) ÷ W from de Boor

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline surface point

    A point of a rational B-spline surface.

    de Boor along v on each of the p + 1 rows, then de Boor along u on the results

    ACIS solids turned into triangles acis/geom.js
    • CadCraft
    • ModelCraft
    64-bit
  • Model size and tolerances

    The size of the whole solid and the tolerances every later test uses.

    size = max(|hi − lo|, 2·rad, 1e-9); tol = max(10 × resabs, 1e-5 × size); weld = 1e-9 × size

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Circular and elliptical edges

    The points along an edge that is part of a circle or an ellipse.

    step = min(7.5°, 2·acos(1 − min(1, 0.0002·size ÷ R))); n = min(4096, ⌈|t₁ − t₀| ÷ max(step, 0.001)⌉)

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline edges

    The points along an edge that follows a B-spline curve.

    N = min(4000, max(64, 24 × spans)) samples; end parameters by nearest sample, then 60 steps of a three-way search; n = ⌈|t₁ − t₀| ÷ (b − a) × N ÷ 4⌉ pieces, 2 to 4096

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Merging vertices

    Gives points that coincide one shared vertex, so a closed solid stays closed.

    key = round(x ÷ weld), round(y ÷ weld), round(z ÷ weld)

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Does the surface fit its edges

    Checks that every edge point of a face lies on the face's surface before the face is used.

    |S(inv(p)) − p| ≤ tol for every loop point

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Which way the triangles face

    Turns a face's triangles so they point the way the face's outward normal does.

    n = (t₁ − t₀) × (t₂ − t₀); vote by the sign of n · normal at the triangle's center

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Flat faces

    Triangles of a flat face with its holes.

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Outer loops and holes

    Sorts the loops of a face into outlines and the holes inside them.

    A = |Σ (uᵢ·vᵢ₊₁ − uᵢ₊₁·vᵢ)| ÷ 2; depth = number of larger loops that contain the middle of the loop's first edge

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Loop unwound on a curved surface

    The (u, v) of a loop's points with the angles unwound along the loop, and how many times it goes round the surface.

    du wrapped to ±half a turn and added up; windings = round(total ÷ period); pole when cos v · r ≤ tol (sphere) or the cone radius ≤ tol

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Step sizes on a curved face

    How finely a curved face is divided.

    angles: 7.5°; spline: range ÷ 16 each way; along a cone's axis: max(3 × 7.5° in radians × R, 1e-12)

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Extra points inside a curved face

    The points added inside a curved face so that its triangles follow the surface.

    one point per grid cell at (i + 0.5 + 0.3·jitter)·cell; kept when inside the face and at least 0.35 × the smaller cell side from every boundary edge

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Fixed offset of a grid point

    A repeatable offset between −0.5 and 0.5 for each grid cell.

    s = sin(12.9898·i + 78.233·j) × 43758.5453; s − ⌊s⌋ − 0.5

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Distance from a point to a segment

    How far an inside point is from a boundary edge, in scaled (u, v).

    t = clamp(((q − s₀)·d) ÷ |d|², 0, 1); distance = |q − s₀ − t·d|

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Body transform

    Moves the mesh by the transform stored with the body.

    p′ = s·(p · M) + t; mirrored when det(M)·s³ < 0

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Is the mesh closed

    Decides whether the mesh is a closed solid: every edge used once in each direction.

    key(a, b) = a × 2³² + b

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Volume and surface area of the mesh

    The volume enclosed by the triangles and their total area.

    V = Σ p · (q × r) ÷ 6; A = Σ |(q − p) × (r − p)| ÷ 2

    ACIS solids turned into triangles acis/tess.js
    • CadCraft
    • ModelCraft
    64-bit
  • Turning a direction

    A direction turned by an angle in degrees.

    (x·cos a − y·sin a, x·sin a + y·cos a), each rounded to 6 decimals

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Turn between two walls

    The signed angle from one wall direction to the next, in degrees.

    atan2(u₀ × u₁, u₀ · u₁) × 180 ÷ π

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • End of a wall typed as length and angle

    The end point of a wall from its start, length and angle.

    (x + L·cos a, y + L·sin a), rounded to 6 decimals

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • End of an arc typed as radius and sweep

    The end point of an arc wall from its radius, sweep and the heading of its chord.

    chord = 2·R·sin(|sweep| ÷ 2); end = start + chord at the heading

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Sagitta

    How far the middle of a straight back of width w stands off a circle of radius r.

    s = r − √(r² − w² ÷ 4)

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Arc through three points

    The radius, center and signed sweep of the arc picked as start, middle and end.

    d = 2·(aₓ(bᵧ − cᵧ) + bₓ(cᵧ − aᵧ) + cₓ(aᵧ − bᵧ)); uₓ = Σ |p|²·(Δy) ÷ d; uᵧ = Σ |p|²·(Δx) ÷ d; r = |a − u|

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Arc from two ends and a sweep

    The radius, center, chord, arc length and sagitta of an arc wall.

    r = chord ÷ (2·sin(θ ÷ 2)); center = middle ± normal × r·cos(θ ÷ 2); arc length = r·θ; sagitta = r·(1 − cos(θ ÷ 2))

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Points along an arc wall

    An arc wall as n straight pieces.

    φᵢ = a₀ ± |θ|·i ÷ n; point = center + r·(cos φ, sin φ), rounded to 6 decimals

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Back line and half angle of each cabinet on an arc

    The radius of each cabinet's back line and the half angle it takes up.

    bay: H = √(R² − w² ÷ 4); bow or curved front: H = R; half angle = atan2(w ÷ 2, H), or w ÷ (2R) for a curved front; front radius = H − d

    Cabinets on angled and curved walls addons/cabinetcraft/lib/angled.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    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.