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

  • Rules from a RUL file

    Grade rules of a piece from the rule numbers on its points.

    k = (25.4 or 1) ÷ (25.4 or 1); move = (ruleₛ − rule_sample) × k → toFixed(4)

    DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js
    • CadCraft
    64-bit
  • Fitting a large piece into one object

    Shrinks the data of a piece that is too large for one drawing object.

    rules → 2 decimals (mm) or 4 (in); points → 3 decimals (mm) or 5 (in); then curve points thinned at 0.02, 0.05, 0.1, 0.2, 0.3, 0.5, 1 mm

    DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js
    • CadCraft
    64-bit
  • Thinning a run of points

    Which curve points of a run must stay so the line stays within a tolerance.

    d = |(P − A) × (B − A)| ÷ |B − A|; the farthest point stays when d > tol

    DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js
    • CadCraft
    64-bit
  • Picked point into the piece's frame

    A point picked in the drawing as a point in the piece's own coordinates.

    local = (insert matrix)⁻¹ · p

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Piece table

    Sew and cut perimeter and area of every piece in every size, as printed and as exported to CSV.

    perimeter → toFixed(2); area ÷ k → toFixed(2), k = 100 for mm² to cm², 1 for in²

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Default grain line

    The grain line a new piece gets: through its centroid, up the page.

    h = 0.3 × (maxY − minY); a = (cₓ, cᵧ − h); b = (cₓ, cᵧ + h); each → toFixed(6)

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Buttonhole from two picked points

    The center, length and angle stored for a buttonhole.

    center = (q + b) ÷ 2; L = |b − q|; angle = atan2(Δy, Δx) × 180 ÷ π

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Do the notches of two seams match

    The line printed for each notch pair when two edges are walked along each other.

    match when |offset| < 0.5 × (1 mm or 0.0625 in)

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Tile overlap typed in inches

    The overlap between printed tiles, in millimeters.

    overlap = typed value × 25.4 in inch drawings

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    Exact
  • Drawing point into the marker's frame

    A drawing point as a point measured from the fabric's lower-left corner, along and across the fabric.

    x′ = cos(−rot)·(x − mₓ) − sin(−rot)·(y − mᵧ); y′ = sin(−rot)·(x − mₓ) + cos(−rot)·(y − mᵧ)

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Marker numbers after a change

    The length, used area, efficiency and piece count kept with a marker after every change to the drawing.

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Automatic nesting on a marker

    Lays the marker's pieces on the fabric and writes their new positions to the drawing.

    raster cell = width ÷ 750; time limit 3000 ms; x = mₓ + cos(rot)·pₓ − sin(rot)·pᵧ; y = mᵧ + sin(rot)·pₓ + cos(rot)·pᵧ; rotation = marker rotation + piece rotation

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Marker PDF page

    The size of the marker's PDF page and the placement of the fabric on it at 1:1.

    k = 25.4 (inch) or 1; W = (x₁ − x₀)·k + 20; H = (y₁ − y₀)·k + 20 + pad; matrix = [k, 0, 0, k, 10 − x₀·k, 10 + pad − y₀·k]

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • A measured length as text

    The text of a seam length or walk difference on the command line.

    mm: 1 decimal, 0 below 0.05; inches: fractions to 1/16

    Apparel commands: piece table, marks and marker output addons/apparel/main.js
    • CadCraft
    64-bit
  • Stock list read from a file

    A stock list with every number checked and each remnant's area, width and height worked out again from its outline.

    area = regionArea(loops); w = x₁ − x₀; h = y₁ − y₀ of the outline (arcs flattened to a sag of 0.001); outline moved so its box corner is (0, 0)

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Stock totals

    The number of available remnants and their total area per material and thickness.

    area = Σ remnant areas

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Numbers in the stock CSV

    The text of a thickness, width, height or area in the exported stock list.

    round(v × 10ᵈ) ÷ 10ᵈ; d = 3 for thickness, 2 for width and height, 1 for area

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Grid of free material

    Marks which cells of the plate are free after the parts, the spacing and narrow strips are taken out.

    cell = min(w, h) ÷ 600; sag = min(cell ÷ 8, 0.1); grow = ⌈(spacing + 2·sag) ÷ cell − 1e-9⌉ + 1 cells; strips narrower than minWidth removed by an opening of ⌊minWidth ÷ cell ÷ 2⌋ cells

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Growing a region on the grid

    Marks every cell within k cells of a marked cell, along rows and then columns.

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    Exact
  • Outline of a free region

    The boundary of one connected region of free cells, as loops on grid corners.

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    Exact
  • Removing points on a straight run

    Drops grid points that lie between their neighbors on a straight line.

    (b − a) × (c − b) ≠ 0 → keep

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    Exact
  • Simplifying an outline

    Removes outline points within half a cell of the simplified line.

    d = |(r − p) × (q − p)| ÷ |q − p|; kept when d > tol

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Remnant outline, size and area

    Each leftover region as an outline with holes, its area and its bounding size.

    point = grid corner × cell, clamped to the plate; simplified by cell ÷ 2; area = regionArea(outline and holes); kept when area ≥ minArea (2 percent of the plate by default)

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Does a remnant match the job

    Whether a remnant has the job's material and thickness.

    |thickness − wanted| < 1e-6

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Job efficiency

    The share of the material used by the parts over all remnants and plates of a job.

    efficiency = Σ part areas ÷ Σ (remnant area or w × h of each plate)

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Adding a job's remnants to the stock

    Marks the remnants a job used and adds the ones it leaves, numbered.

    stored outline = outline − (x₀, y₀); w, h and area as found by leftovers

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Exact re-check of remnants against parts

    Confirms on the polygons that no remnant touches a placed part and that the spacing is kept.

    distance between every pair of edges; overlap when ≤ 1e-6 or one contains the other's first point; too close when < spacing − 1e-6

    Offcut stock after nesting addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    64-bit
  • Label position and text height

    The point where a remnant's number is written and the height of that text.

    d = chamfer distance in cells (steps 1 and 1.4142); x = (i + 0.5) × cell; y = (j + 0.5) × cell; h = max(cell, min(0.6 × d × cell, height ÷ 4))

    Where a remnant's number is written addons/apparel/lib/nest/nest-stock.js
    • CadCraft
    • PartCraft
    32-bit in part
  • Rule units per drawing unit

    The factor between the drawing's unit and the cabinet rules' unit, and its reciprocal.

    per = meters per drawing unit ÷ (0.0254 or 0.001); k = 1 ÷ per

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Placing a cabinet on the run

    The insertion point and rotation of a new cabinet, and where the next one starts.

    w = typed × per; x = runₓ + cos(ang)·pos·k; y = runᵧ + sin(ang)·pos·k; next pos = pos + w

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Cabinets of a front view

    Which cabinets stand on a wall line and how far along it, for the front view.

    on the run when |sin(rot − ang)| ≤ 1e-6, cos(rot − ang) ≥ 0 and |offset| ≤ 0.5 × depth × k; x = s ÷ k − smallest x, rounded to 6 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Area as text

    The area of a material group on the command line.

    in² ÷ 144 = ft²; mm² ÷ 1e6 = m²; 3 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Edge banding length as text

    The length of edge banding on the command line.

    in ÷ 12 = ft; mm ÷ 1000 = m; 3 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Sheet use in percent

    The share of each material's sheets covered by parts, as printed after nesting.

    percent = round(efficiency × 100)

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Millimeters in one drawing unit

    The factor from the drawing's unit to millimeters.

    mm per unit = meters per unit ÷ 0.001; inch 0.0254, foot 0.3048, yard 0.9144, cm 0.01, m 1

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Room outline from a polyline

    The corners of a closed polyline in millimeters, with arcs turned into chords.

    sweep = 4·atan(bulge); steps = max(1, ⌈|sweep| ÷ 15°⌉); r = chord ÷ (2·sin(|sweep| ÷ 2)); point = (c + r·(cos, sin)) × f

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Drawing units per job unit

    The factor that scales the cabinet job (millimeters or inches) to the drawing's unit.

    k = (25.4 or 1) ÷ mm per drawing unit

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Room area in the list

    The floor area shown beside each closed polyline offered as a room.

    area = |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| ÷ 2 ÷ 1e6 m²; shown as round(area × 100) ÷ 100

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Door and window openings read from blocks

    The position and width of each door or window block near the room.

    w = max(box width, box height) × f, limited to 300…3000 mm; position = insertion point × f

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Where the sheets are drawn

    The point in the drawing where the shop drawing sheets start.

    intended: x = right edge of what is drawn + 0.3 × tallest sheet; y = its top edge

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    64-bit
  • Cabinet solids for the 3D tab

    The faces of each cabinet as polygons in drawing units.

    point = (x ÷ f, y ÷ f, z ÷ f)

    CabinetCraft in a drawing: units, room outline and solids addons/cabinetcraft/host.js
    • CadCraft
    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.