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

  • Count of block references

    How many references of the named blocks there are, in total, by variant and by layer.

    total = number of matching references

    Counting blocks, shapes and texts in a CAD drawing cadcount.js
    • TakeoffCraft
    Exact
  • Which sheet shows an object, and where

    The page point of a drawing object on a sheet, through the first viewport that contains it.

    Counting blocks, shapes and texts in a CAD drawing cadset.js
    • TakeoffCraft
    64-bit
  • Bézier curves cut into chords

    Turns each cubic or quadratic curve of the page into 8 straight segments.

    B(t) = u³p₀ + 3u²t·c₁ + 3u·t²·c₂ + t³p₃, u = 1 − t, t = s ÷ 8

    Snapping to and measuring the sheet's own linework snap.js
    • TakeoffCraft
    64-bit
  • Where two segments cross

    The crossing point of two segments, offered as a snap point.

    u = ((c − a) × s) ÷ (r × s); point = a + r·u

    Snapping to and measuring the sheet's own linework snap.js
    • TakeoffCraft
    64-bit
  • Snap point for a picked point

    The end point, midpoint, intersection or nearest point on a line within the snap distance.

    Snapping to and measuring the sheet's own linework snap.js
    • TakeoffCraft
    64-bit
  • Connected path through a segment

    The segment that was clicked and everything joined to it end to end within the gap tolerance.

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • Next segment at a junction

    Chooses which segment a path continues along from an end point.

    score = turn angle + (0.01 when the ends are more than 1e-9 apart)

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • Vertices of a picked path

    The points of the path in order, as they will be stored in the mark.

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • Length of a picked path

    The length of the path in sheet units.

    L = Σ |pᵢ − pᵢ₋₁|

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • Area of a picked loop

    The area inside a closed path in square sheet units.

    A = |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| ÷ 2

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • Closed loops around a clicked point

    Finds the closed paths that have the clicked point inside, smallest first.

    Snapping to and measuring the sheet's own linework pickpath.js
    • TakeoffCraft
    64-bit
  • A CAD sheet's lines for snapping

    The drawing's own line segments in page units, through the sheet and viewport matrices.

    Snapping to and measuring the sheet's own linework cadset.js
    • TakeoffCraft
    64-bit
  • Picked path in real units

    The length and area of what is picked, shown while picking.

    ft = L × k; SF = A × k²

    Snapping to and measuring the sheet's own linework takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Room around a point

    Flood-fills the room and returns its outline in pixel corners.

    Room outline by flood fill roomfill.js
    • TakeoffCraft
    64-bit
  • Outline traced along pixel edges

    Walks the outer boundary of the filled region, corner by corner.

    Room outline by flood fill roomfill.js
    • TakeoffCraft
    Exact
  • Outline simplified

    Removes corners that lie within a tolerance of the line between their neighbors.

    d = |(p − a) × (b − a)| ÷ |b − a| ≤ 1.0 px

    Room outline by flood fill roomfill.js
    • TakeoffCraft
    64-bit
  • Room outline back in sheet units

    Sets the raster scale and the door gap in pixels, and maps the outline's pixel corners back to sheet coordinates.

    gapPx = gap ÷ ftPerUnit × per × w; p = T⁻¹·(q ÷ w)

    Room outline by flood fill takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Picture to ink darkness

    Turns the canvas pixels of a sheet into darkness from 0 (paper) to 1 (black).

    ink = 1 − (lum·a + (1 − a)), lum = (0.299R + 0.587G + 0.114B) ÷ 255

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Symbol turned to an angle

    Rotates the symbol's raster for a search at an angle.

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Integral images

    Running sums of ink and of ink squared, so any window's sum costs four lookups.

    sum(window) = S[e] − S[b] − S[c] + S[a]

    Automatic count by symbol matching match.js
    • TakeoffCraft
    64-bit
  • Match score at every position, and its peaks

    Scores how well the symbol matches at each position and keeps the local best ones.

    score = Σ (t − t̄)·img ÷ (σₜ·√n × √(v·n)), v = Σimg² ÷ n − (Σimg ÷ n)²

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Search at each angle

    Runs the match at every angle asked for and collects the finds.

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Angle of a find refined

    Tries angles within 7.5° of a find in 1.5° steps and keeps the best.

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Finds kept at the threshold

    Keeps the finds at or above the threshold, best first, and drops any that overlaps a kept one.

    keep when score ≥ threshold and IoU with every kept find ≤ 0.25

    Automatic count by symbol matching match.js
    • TakeoffCraft
    32-bit in part
  • Raster scale for a search

    The pixels per sheet unit that make the symbol's longer side about 40 pixels.

    w = clamp(40 ÷ max(boxW, boxH), 0.2, 4)

    Automatic count by symbol matching match.js
    • TakeoffCraft
    64-bit
  • How alike two symbols are

    The best normalized correlation of two symbols over shifts of up to one pixel.

    likeness = max over shifts of Σ(p − p̄)(q − q̄) ÷ √(Σ(p − p̄)² · Σ(q − q̄)²)

    Automatic count by symbol matching legend.js
    • TakeoffCraft
    64-bit
  • One find per spot across symbols

    Merges overlapping finds of one symbol, and gives a spot two symbols match to the higher score.

    Automatic count by symbol matching legend.js
    • TakeoffCraft
    32-bit in part
  • Counts per symbol and per sheet

    Counts the kept finds for each symbol, in total and on each sheet.

    Automatic count by symbol matching legend.js
    • TakeoffCraft
    Exact
  • Raster sizes for a sheet at another scale

    The pixel sizes to search a sheet at so a symbol drawn to scale keeps its size in pixels.

    w′ = w × tgtFt ÷ srcFt when |tgtFt ÷ srcFt − 1| > 0.01

    Automatic count by symbol matching legend.js
    • TakeoffCraft
    64-bit
  • Learned symbol saved and read back

    Stores an accepted symbol in the file and reads it back for a later search.

    byte = round(ink × 255); ink′ = byte ÷ 255

    Automatic count by symbol matching learn.js
    • TakeoffCraft
    32-bit in part
  • Same symbol as one already learned

    The normalized correlation of two symbols over their common area.

    ncc = Σ(a − ā)(b − b̄) ÷ √(Σ(a − ā)² · Σ(b − b̄)²)

    Automatic count by symbol matching learn.js
    • TakeoffCraft
    64-bit
  • Find placed on the sheet

    Maps a find's pixel box back to sheet coordinates and takes its middle as the count mark's point.

    p = T⁻¹·((x + w ÷ 2) ÷ wt, (y + h ÷ 2) ÷ wt)

    Automatic count by symbol matching takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Similarity from two point pairs

    The move, turn and uniform scale that take two points of the old sheet to two points of the new one.

    c + i·s = (b₂ − b₁) ÷ (a₂ − a₁); t = b₁ − (c + i·s)·a₁

    Revision overlay: lining up two sheets and moving the takeoff overlay.js
    • TakeoffCraft
    64-bit
  • Scale of an alignment

    How much longer a length becomes under the alignment.

    scale = √(m₀² + m₁²)

    Revision overlay: lining up two sheets and moving the takeoff overlay.js
    • TakeoffCraft
    64-bit
  • Marks moved onto the new sheet

    Applies the alignment to every point of a mark.

    p′ = A·p; b′ = b

    Revision overlay: lining up two sheets and moving the takeoff overlay.js
    • TakeoffCraft
    64-bit
  • Old sheet's pixels under the new sheet

    The matrix from a pixel of the new sheet's raster to a pixel of the old one.

    Revision overlay: lining up two sheets and moving the takeoff overlay.js
    • TakeoffCraft
    64-bit
  • Applying, multiplying and inverting a transform

    The 2 × 3 matrix operations behind sheet transforms.

    det = m₀·m₃ − m₁·m₂; M⁻¹ = adj(M) ÷ det

    Revision overlay: lining up two sheets and moving the takeoff geom.js
    • TakeoffCraft
    64-bit
  • Alignment from four picks

    Collects two points on the old sheet and two on the new one and fits the alignment.

    Revision overlay: lining up two sheets and moving the takeoff takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Scale carried to the new sheet

    The scale the moved marks are measured with on the new sheet.

    ftPerUnit′ = ftPerUnit ÷ scale(A)

    Revision overlay: lining up two sheets and moving the takeoff takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Where the two sheets differ

    Marks each pixel as removed, added or unchanged, and counts both kinds.

    removed: old ≥ 0.35 and max(new within r) < 0.2; added: the reverse

    Revision overlay: what changed under a mark overlay.js
    • TakeoffCraft
    64-bit
  • How much changed along a mark

    The share of a mark's path with changed ink beside it, whether a corner changed, and the changed pixels near it.

    share = samples with changed ink within the buffer ÷ samples

    Revision overlay: what changed under a mark overlay.js
    • TakeoffCraft
    64-bit
  • Changed pixels in a box

    How many changed pixels lie in a rectangle of the mask.

    n = S[y₁+1][x₁+1] − S[y₀][x₁+1] − S[y₁+1][x₀] + S[y₀][x₀]

    Revision overlay: what changed under a mark overlay.js
    • TakeoffCraft
    Exact
  • Raster sizes and the mark test

    Chooses the two raster scales, builds the pixel map between them and tests every mark of the old sheet.

    px = min(2, √(12,000,000 ÷ (W × H)))

    Revision overlay: what changed under a mark takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Sheet coordinates to feet on the ground

    Maps a point of the sheet to feet in the 3D view.

    k = ftPerUnit ÷ √|det T|; (x, y) → (dx·k, (height − dy)·k)

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Wall area of a run

    The area of the wall a run with a height stands for.

    wall area = L × H

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Net area and volume of a slab

    An area's net square feet after back-outs, and its volume when it has a depth.

    net = max(0, A − cut); V = net × D

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Totals over stacked sheets

    Adds the totals of each sheet when several sheets are stacked as floors.

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Outline of a wall with a thickness

    Offsets a run half the thickness to each side, with mitred corners, into one closed outline.

    offset = min(half ÷ max(cos, 1e-6), 4 × half) along the bisector

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Solid from an outline and its cut-outs

    Triangulates the top and bottom faces and builds the side faces of a slab or wall.

    3D check view: walls, slabs and their quantities scene3d.js
    • TakeoffCraft
    64-bit
  • Feet to meters, Z up to Y up

    Converts one vertex from the view's feet to glTF's meters and axes.

    (x, y, z) ft → (0.3048·x, 0.3048·z, −0.3048·y) m

    3D check view exported as glTF glb.js
    • TakeoffCraft
    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.