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

  • Quantity with waste

    A quantity increased by a waste percentage.

    qtyW = qty × (1 + bp ÷ 10000)

    Rates, percentages and extended amounts units.js
    • TakeoffCraft
    64-bit
  • Cents as dollars text

    Writes whole cents as $1,234.56.

    Rates, percentages and extended amounts units.js
    • TakeoffCraft
    Exact
  • Typed bid amount to cents

    Reads an amount typed into the bid leveling sheet as whole cents.

    cents = round(rate4 ÷ 100)

    Rates, percentages and extended amounts takeoffcraft.js
    • TakeoffCraft
    Exact
  • Typed pitch to rise per 12

    Reads 6:12, 6/12, 4:10, a bare rise, or an angle in degrees.

    rise = tan(a·π ÷ 180) × 12; rise = rise ÷ run × 12

    Roof pitch and slope factors units.js
    • TakeoffCraft
    64-bit
  • Slope factor of a roof plane

    Surface length or area per unit of plan length or area.

    f = √(1 + (rise ÷ 12)²)

    Roof pitch and slope factors units.js
    • TakeoffCraft
    64-bit
  • Hip and valley factor

    True length of a hip or valley per unit of its plan length.

    f = √(1 + (rise ÷ 12)² ÷ 2)

    Roof pitch and slope factors units.js
    • TakeoffCraft
    64-bit
  • Pitch as text

    Writes the rise as 6:12 or 6.5:12.

    Roof pitch and slope factors units.js
    • TakeoffCraft
    64-bit
  • Signed coordinate length

    Reads one typed coordinate, which may be negative or zero, into feet.

    Typed distances and coordinates while drawing typein.js
    • TakeoffCraft
    64-bit
  • Sheet direction of a screen direction

    The unit vector on the sheet that points along a given direction on the screen.

    u = M⁻¹·(sx, −sy); u ÷ |u|

    Typed distances and coordinates while drawing typein.js
    • TakeoffCraft
    64-bit
  • Point from typed text

    Works out the next point from a distance, a distance and angle, or coordinates.

    p = last + dir × ft × k, k = 1 ÷ ftPerUnit

    Typed distances and coordinates while drawing typein.js
    • TakeoffCraft
    64-bit
  • Circle radius typed while drawing

    Places a circle's edge point at a typed radius from its center, toward the pointer.

    edge = c + (to − c) ÷ |to − c| × ft ÷ ftPerUnit

    Typed distances and coordinates while drawing takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Typed spot elevation

    Reads the elevation typed on a count mark, in decimal feet, feet-inches or meters.

    Typed distances and coordinates while drawing takeoffcraft.js
    • TakeoffCraft
    64-bit
  • One CAD object as points and bulges

    The run or outline that stands for a line, arc, circle, polyline, ellipse, spline or 2D solid.

    arc: p = c + r·(cos a, sin a), b = tan(sweep ÷ 4); ellipse: n = max(24, ⌈1440·sweep ÷ 2π⌉) chords

    Lengths and areas taken from CAD objects cadgeom.js
    • TakeoffCraft
    64-bit
  • Hatch as outlines with holes

    The outer loops of a hatch, each with the loops inside it as cut-outs.

    Lengths and areas taken from CAD objects cadgeom.js
    • TakeoffCraft
    64-bit
  • Object placed on the sheet

    Applies the sheet or viewport matrix to an object's points and decides whether a viewport shows it.

    p′ = T·(mirror·x, y); b′ = b × sign(det T × mirror)

    Lengths and areas taken from CAD objects cadgeom.js
    • TakeoffCraft
    64-bit
  • Marks made from picked objects

    The point lists a linear or an area item takes from the picked objects.

    Lengths and areas taken from CAD objects cadgeom.js
    • TakeoffCraft
    64-bit
  • Length and area of what is picked

    The total length or net area of the picked objects in page units.

    len = Σ length; area = Σ (gross − cut-outs)

    Lengths and areas taken from CAD objects cadgeom.js
    • TakeoffCraft
    64-bit
  • Picked objects in real units

    The length or area of the picked CAD objects shown above the sheet.

    SF = area × k²; ft = len × k

    Lengths and areas taken from CAD objects takeoffcraft.js
    • TakeoffCraft
    64-bit
  • Product of two transforms

    Combines two 2 × 3 affine matrices.

    Counting blocks, shapes and texts in a CAD drawing cadcount.js
    • TakeoffCraft
    64-bit
  • Place of a block reference and its array cells

    The point of each copy of a block reference, and the transform its contents get.

    p = M·(insert + R(rot)·(c·dx, r·dy))

    Counting blocks, shapes and texts in a CAD drawing cadcount.js
    • TakeoffCraft
    64-bit
  • Point that stands for a shape

    The one point a shape is placed and counted by: a center, a middle, or the middle of its box.

    Counting blocks, shapes and texts in a CAD drawing cadcount.js
    • TakeoffCraft
    64-bit
  • 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

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.