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.
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.jsExact- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
Room around a point
Flood-fills the room and returns its outline in pixel corners.
Room outline by flood fill roomfill.js64-bit- TakeoffCraft
-
Outline traced along pixel edges
Walks the outer boundary of the filled region, corner by corner.
Room outline by flood fill roomfill.jsExact- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
Symbol turned to an angle
Rotates the symbol's raster for a search at an angle.
Automatic count by symbol matching match.js32-bit in part- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
Search at each angle
Runs the match at every angle asked for and collects the finds.
Automatic count by symbol matching match.js32-bit in part- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
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.jsExact- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js32-bit in part- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.jsExact- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
-
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.js64-bit- TakeoffCraft
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.