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
-
Tile grid
How many tiles across and down the pieces need.
pw = paper w − 2·margin; ph = paper h − 2·margin − 8; step = pw − overlap, ph − overlap; cols = max(1, ⌈(W − overlap) ÷ step − 1e-9⌉)
Printing patterns at full size addons/apparel/lib/print.js64-bit- CadCraft
-
Which tiles have something on them
Marks the tiles a point of the drawing falls on, so empty tiles are not printed.
c from ⌈(x − pw) ÷ sx⌉ to ⌊x ÷ sx⌋; r from ⌈(−y − ph) ÷ sy⌉ to ⌊−y ÷ sy⌋
Printing patterns at full size addons/apparel/lib/print.js64-bit- CadCraft
-
Placement on one tile
Where the pieces land on the page of one tile.
tx = c·sx; ty = −r·sy; matrix = [k, 0, 0, k, margin − tx − minX·k, (paper h − margin − 8) − ty − maxY·k]
Printing patterns at full size addons/apparel/lib/print.js64-bit- CadCraft
-
A number as file text
The text of a coordinate, angle or text height in the DXF.
r = round(v × 1e6) ÷ 1e6; −0 → 0
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Piece to drawing coordinates
A point of a piece moved to where the piece lies in the drawing.
x′ = x + cos(rot)·sx·pₓ − sin(rot)·sy·pᵧ; y′ = y + sin(rot)·sx·pₓ + cos(rot)·sy·pᵧ
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
What a piece writes
The cut line, sew line, notches, grain line and marks of one piece in one size, in drawing coordinates.
corner on the cut line when the turn > 0.17 rad; notch angle = atan2 of the inward direction × 180 ÷ π
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Grade rule of a written point
The move of one written point in every size, measured from the base size.
rule = [(xₛ − x_base, yₛ − y_base) for each size s]
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Rounding and sharing rules
Gives every rule a number; identical rules share one.
dx, dy → round(v × 100) ÷ 100
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Rules in the RUL file
The lines of the rule file: an x and y pair per size for every rule.
x.toFixed(2), y.toFixed(2), four pairs to a line
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Reading a RUL file
The sizes, sample size and rules of a rule file.
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Corners and curve points of a read outline
Decides which points of an outline read from someone else's file are corners.
tol = max(1e-6, 1e-7 × largest |coordinate|) + 0.02 mm (0.001 in); corner when a turn point lies within tol, or the turn > 0.35 rad
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Outline points kept from a file
The outline of a piece read from someone else's file.
x, y → toFixed(6)
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Seam allowance read from a file
The allowance of each edge, from how far the file's cut line is from its sew line.
edge width = median of the distances from the edge's sample points to the cut line → 2 decimals (mm) or 4 (in); common width = median of the edges
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
Rules from a file with every size drawn
Grade rules worked out from blocks that draw the piece in each size.
rule = pointₛ − point_base → toFixed(4)
DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.jsExact- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.jsExact- CadCraft
- PartCraft
-
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.jsExact- CadCraft
- PartCraft
-
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.jsExact- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
- PartCraft
-
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.js32-bit in part- CadCraft
- PartCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
-
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.js64-bit- CadCraft
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.