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

  • Squaring level and plumb lines

    Makes nearly horizontal and vertical lines exactly so, and gives lines of one wall the same coordinate.

    y = (y₁ + y₂) ÷ 2; shared coordinate = Σ(coordinate × length) ÷ Σ length

    Tracing a scan into lines and arcs raster/trace.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Closing corners

    Moves a line end to the point where its line meets a nearby line.

    s = ((B₁ − E) × v) ÷ (u × v); new end = E + s·u

    Tracing a scan into lines and arcs raster/trace.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Lines and arcs in image coordinates

    The traced lines and arcs with the window offset added and the arc end points worked out.

    start = (cx + r·cos a₀, cy + r·sin a₀); end = (cx + r·cos a₁, cy + r·sin a₁)

    Tracing a scan into lines and arcs raster/trace.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Crossing of two traced lines

    The point where two traced line segments cross.

    d = (a₂ − a₁) × (b₂ − b₁); t = ((b₁ − a₁) × (b₂ − b₁)) ÷ d; point = a₁ + t·(a₂ − a₁)

    Tracing a scan into lines and arcs raster/snap.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Snap points of a trace

    The ends, middles, arc centers, corners and crossings offered for snapping.

    middle = (p₁ + p₂) ÷ 2; arc middle at angle (a₀ + a₁) ÷ 2; corner = mean of the ends within 3 px

    Tracing a scan into lines and arcs raster/snap.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Black-and-white level (Otsu)

    The grey level that best separates ink from paper for the whole sheet.

    maximize w_B × w_F × (m_B − m_F)² over the 256 levels

    Scan clean-up and JPEG decoding raster/image.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Local threshold (Sauvola)

    Decides ink or paper for each pixel from the mean and spread of the pixels around it.

    ink when v ≤ mean × (1 + k × (sd ÷ 128 − 1)); sd = √(Σv² ÷ n − mean²)

    Scan clean-up and JPEG decoding raster/image.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Sheet skew angle

    The angle by which the long lines of a scanned sheet are rotated.

    score(angle) = Σ rows² + Σ columns² of the ink projected at that angle; best angle on a 0.25° then 0.02° grid

    Scan clean-up and JPEG decoding raster/image.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Rotating the image

    Turns a grey image by an angle about its middle.

    source = c + R(angle) × (pixel − c); value = bilinear mix of the 4 nearest source pixels

    Scan clean-up and JPEG decoding raster/image.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • JPEG inverse cosine transform

    Turns the stored frequency coefficients of an 8 × 8 block back into pixel values.

    pixel = round(Σ_u Σ_v C(x,u)·C(y,v)·coef(u,v) + 128), clamped to 0–255

    Scan clean-up and JPEG decoding raster/jpeg.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • JPEG color conversion

    Converts the decoded luminance and color-difference values to red, green and blue.

    R = Y + 1.402·Cr; G = Y − 0.344136·Cb − 0.714136·Cr; B = Y + 1.772·Cb

    Scan clean-up and JPEG decoding raster/jpeg.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Table values in millimeters

    Converts each published row to millimeters, mm² and kg/m.

    mm = in × 25.4; mm² = in² × 25.4 × 25.4; kg/m = lb/ft × 1.48816394; r = (k_des − t_f) × 25.4

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Exact section area

    The cross-section area worked out from the dimensions, with fillets and rounded corners included.

    I: 2·b_f·t_f + (d − 2t_f)·t_w + (4 − π)·r²; RHS: 2t(h + b − 2t) − (4 − π)(r_o² − r_i²); CHS: π(D − t)·t

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Section outline

    The outline of a section as loops of points, centered on its bounding box.

    arc point = (cx + r·cos a, cy + r·sin a), a = a₀ + (a₁ − a₀)·i ÷ n

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Rounded rectangle loop

    The outer or inner loop of a rectangular hollow section with rounded corners.

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Loop area

    The signed area of an outline loop.

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

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Loop perimeter

    The length around an outline loop.

    L = Σ √(Δx² + Δy²)

    Steel section dimensions, areas and outlines shapes/sections.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Part sizes in millimeters

    The table dimensions of each size of a part family, with inch sizes converted.

    mm = in × 25.4; pitch = 25.4 ÷ threads per inch

    Standard parts and library items shapes/parts.js
    • CadCraft
    • PartCraft
    64-bit
  • Hexagon area

    The area of a hexagon from its width across flats.

    A = (√3 ÷ 2) × s²

    Standard parts and library items shapes/parts.js
    • CadCraft
    • PartCraft
    64-bit
  • Mass from volume

    The mass of a part in kilograms from its volume in mm³.

    kg = mm³ × 10⁻⁹ × 7850, rounded to 4 decimals

    Standard parts and library items shapes/parts.js
    • CadCraft
    • PartCraft
    64-bit
  • Inch length as a fraction

    Writes an inch length as a whole number and a fraction for the part's designation.

    n = round(v × 64); reduce n ÷ 64

    Standard parts and library items shapes/parts.js
    • CadCraft
    • PartCraft
    64-bit
  • Part dimensions and mass

    The full set of dimensions, the bounding box and the mass of one part.

    e = 2s ÷ √3; bolt mass = (hex area × k + π ÷ 4 × d² × l) × ρ; gear: d = m·z, d_a = m(z + 2), d_f = m(z − 2.5), d_b = d·cos 20°

    Standard parts and library items shapes/parts.js
    • CadCraft
    • PartCraft
    64-bit
  • Coordinate rounding in library items

    Rounds every coordinate written into a library item's drawing.

    round(v × 1000) ÷ 1000

    Standard parts and library items shapes/items.js
    • CadCraft
    • PartCraft
    64-bit
  • Steel section as a library item

    The section view or side elevation of a steel section, with its size and weight parameters.

    kg/m = published mass, else area × 10⁻⁶ × 7850; weight = kg/m × length ÷ 1000

    Standard parts and library items shapes/items.js
    • CadCraft
    • PartCraft
    64-bit
  • Bolt drawing dimensions

    The head, shank, chamfer and thread lines of a bolt's side view.

    thread root diameter = D − 1.22687 × pitch; chamfer = min(pitch, D ÷ 4)

    Standard parts and library items shapes/items.js
    • CadCraft
    • PartCraft
    64-bit
  • Standard part as a library item

    The drawing, size parameters and weight of a standard part as a library item.

    Standard parts and library items shapes/items.js
    • CadCraft
    • PartCraft
    64-bit
  • Parameter levels

    The evenly spaced values of a parameter between its two bounds.

    vᵢ = from + (to − from) × i ÷ (steps − 1)

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Rounding of parameter values

    Rounds a parameter value before it is put in a variant.

    v → v to 12 significant digits

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Variant list

    Every combination of parameter levels, or a seeded random sample between the bounds.

    random: v = from + (to − from) × u, u = 32-bit integer ÷ 2³²

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Meeting the limits

    Whether a variant's results meet every limit of the study.

    min goal: value ≤ limit; max goal: value ≥ limit

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Trade-off front

    The variants that no other variant beats on every goal at once.

    a dominates b when a is no worse on every goal and better on at least one

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Weighted ranking

    A score for each feasible variant from its goals and the weights a person gives.

    x = (value − lo) ÷ (hi − lo); score = Σ w × (x for max goals, 1 − x for min goals)

    Design study variants and ranking study/study.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Load factor to the limit

    The factor by which every load can be multiplied before the design's utilization reaches 1.

    find λ with util(λ) = 1: double λ until util ≥ 1, then bisect with mid = √(lo × hi) until hi − lo ≤ 10⁻⁴ × hi

    Load reserve and escape route checks study/breakit.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Escape route widths

    For each room, the route out whose narrowest door is widest, and its margin against the required width.

    width of a route = min of its door widths; margin = width − required

    Load reserve and escape route checks study/breakit.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Part reserve from a stress study

    The load factor to first yield and to buckling of a solved part.

    λ = minimum safety factor ÷ wanted safety factor; utilization = 1 ÷ λ

    Load reserve and escape route checks study/breakit.js
    • CadCraft
    • BimCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Matrix product

    Combines two transforms into one.

    o[c][r] = Σₖ a[k][r] × b[c][k]

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Matrix inverse

    The transform that undoes another.

    inverse = cofactor matrix ÷ determinant

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Transforming a point

    Applies a transform to a point.

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

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Rotation about an axis

    The matrix of a rotation by an angle in degrees about X, Y or Z.

    a = deg × π ÷ 180; entries cos a, ± sin a

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Quaternion to rotation matrix

    The rotation matrix of an orientation stored as a quaternion.

    q ÷ |q|; R₀₀ = 1 − 2(y² + z²), R₀₁ = 2(xy + wz), …

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Value at a time

    An animated value at a given time, between its stored samples.

    v = a + (b − a) × (t − t₀) ÷ (t₁ − t₀)

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • An object's own transform

    Builds the transform of one object from its list of translate, rotate, scale and matrix operations.

    M = op₁ × op₂ × … in the listed order; an inverted operation uses its inverse

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • World transform

    The transform of an object in the scene, through all its parents.

    W = M_root × … × M_parent × M_own

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Scene units and up axis

    The transform from the scene's own units and up axis to meters with Z up.

    scale by metersPerUnit; Y-up scenes: rotate 90° about X

    USD transforms and placement usd/geom.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Placement of instanced copies

    The transform of each copy of a point instancer from its position, orientation and scale.

    M = translate(p) × rotate(q) × scale(s)

    USD transforms and placement usd/scene.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Writing an object's transform

    Stores an object's placement in the exported scene.

    USD transforms and placement usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Attribute value to its storage type

    Converts a list of numbers to the number type its USD attribute type calls for.

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Mesh points and extent

    Stores the points of a mesh and its bounding box in the scene.

    extent = [min x, min y, min z, max x, max y, max z] of the points

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit in part
  • Lamp intensity

    Converts a lamp's lumens to the intensity a renderer reads.

    intensity = lumens ÷ (683 × area × π)

    USD mesh coordinates in saved and exported files usd/build.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    32-bit, display only
  • Single values in the binary file

    Writes one number, tuple or matrix into the binary USD file.

    USD mesh coordinates in saved and exported files usd/usdc-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • 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.