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
-
Offset of one edge
One edge of the sew line moved outward by its allowance.
n = (tᵧ, −tₓ); moved point = p + n·w; join = meeting point of the two moved lines when |t₁ × t₂| > 1e-9 and it is within 4·w of the vertex
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Offset of an outline with no corners
A closed smooth outline moved outward by one allowance all round.
vertex = meeting point of the two moved lines; fallback = b + right((t₁ + t₂) ÷ 2)·w
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Dropping repeated points
Removes points that repeat the one before.
kept when |p − previous| > 1e-9
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Dropping points on a straight line
Removes cut line points that lie on the straight line between their neighbors.
kept when |u × v| > 1e-9 × |u| × |v|
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Inside corner
Trims two cut lines where they cross at an inside corner.
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Corner between two allowances
The points that join the cut lines of two edges at a corner, by the corner's rule.
turn = tₐ × t_b; turn < −1e-9 → inside corner; meeting points used only within 20 × the wider allowance of the corner
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
The whole cut line
The closed cut line of a piece from its sew line and allowances.
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Rounding to 6 decimals
Rounds a value to 6 decimals.
r6(v) = number(v.toFixed(6))
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Even step per size
A rule that moves a point by the same step for each size away from the base.
move of size i = (i − base) × step
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Rules in proportion between two points
Rules for the outline points between two ruled points, by distance along the outline.
s = distance from A ÷ distance A to B; rule = r_A + (r_B − r_A)·s
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Position of each point along the outline
How far along the sampled outline each outline point lies, and the outline's length.
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
The sew line in a size
The outline points of a piece in one size.
point = base + move; unruled curve point: move = m_lo + (m_hi − m_lo)·s, s = d ÷ d_hi
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
The whole piece in a size
The piece with its grain line, fold line, internal lines, drill holes, buttons and label moved to one size.
mark = base + move of its rule, rounded to 6 decimals
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Rules after a change of sizes or base
The rules re-measured from a new base size.
new move = old move − old move of the new base
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Rules read from a file
Checks the grade rules of a piece that came from a file or the clipboard.
Grading a pattern across sizes addons/apparel/lib/grade.js64-bit- CadCraft
-
Polyline arc to curve points
The curve points that stand for one arc segment of a polyline.
θ = 4·atan(bulge); r = L ÷ (2·sin(|θ| ÷ 2)); n = max(2, ⌈|θ| ÷ 15°⌉) points at equal angles
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Outline from a closed polyline, circle or ellipse
The sew line of a new piece from one closed object.
circle: 12 curve points at 30°; ellipse: 16 curve points at 22.5° of its parameter
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Outline from lines and arcs that join up
The sew line of a new piece from separate lines, arcs and open polylines.
arc: n = max(2, ⌈sweep ÷ 15°⌉) steps; ends join when |p − q| ≤ 1e-4
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Smooth vertices
Decides which vertices of the outline are curve points.
turn = |atan2(next − p) − atan2(p − previous)|; next to an arc and turn < 2° → curve point
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Stored outline points
Cleans the new outline and rounds it for storage.
x, y → toFixed(6)
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Where a notch sits
The position of a notch on the cut line, opposite its place on the sew line.
q = point at distance d along the edge; notch = q + outward normal × allowance
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
A new notch from a picked point
The edge and distance along it for a notch placed at a picked point.
nearest point over all edges; d → toFixed(4)
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Notch geometry
The lines of a slit, V or T notch.
a = ang × π ÷ 180; direction = −R(a)·normal; tip = notch + direction × depth
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Moving a point by its grip
The piece after one of its points or marks was dragged.
new position → toFixed(6)
Pattern pieces from drawing geometry addons/apparel/lib/piece.js64-bit- CadCraft
-
Thinning a cut line
A closed cut line with the points removed that lie within a tolerance of the simplified line.
d = |(P − A) × (B − A)| ÷ |B − A|; kept when d > tol
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
A piece's copy for the marker
The cut line, grain angle and area stored with a piece placed on a marker.
x, y → toFixed(2) in mm, toFixed(4) in inches; area = |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| ÷ 2 → toFixed(4); grain = atan2 of the grain line
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Piece to drawing coordinates
The position in the drawing of a point of a placed piece.
x′ = x + cos(rot)·sx·pₓ − sin(rot)·sy·pᵧ; y′ = y + sin(rot)·sx·pₓ + cos(rot)·sy·pᵧ
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Grain direction check
Whether a placed piece's grain line runs along the fabric within the marker's tolerance.
tol = degrees × π ÷ 180 + 1e-6; ok when the angle between grain and fabric length ≤ tol (or to the opposite direction, on fabric that may be turned)
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Is the piece on the fabric
Whether a piece lies on the fabric, off it, or across an edge.
bounding box in the marker's frame against 0 … width and 0, with eps = 0.01 mm or 0.0005 in
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Do two edges cross
Whether two cut line segments cross strictly inside both.
den = r × q; u = ((c − a) × q) ÷ den; v = ((c − a) × r) ÷ den; crossing when 1e-9 < u, v < 1 − 1e-9
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Do two pieces overlap
Whether two placed pieces overlap.
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Marker length and efficiency
The fabric length used, the area of the pieces and the share of the fabric they cover.
len = max x of the pieces + end allowance; used = Σ area; eff = used ÷ (len × width)
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Marker label
The width, length and efficiency written under the marker.
inches: 2 decimals; mm: 1 decimal, or meters with 3 decimals from 1000 mm; efficiency: percent with 1 decimal
Markers: pieces laid on fabric addons/apparel/lib/marker.js64-bit- CadCraft
-
Paper sizes
The two home-printer papers, in millimeters.
A4 = 210 × 297; Letter = 215.9 × 279.4 (8.5 × 11 in × 25.4)
Printing patterns at full size addons/apparel/lib/print.jsExact- CadCraft
-
Test square
The side of the square printed on the cover page to check the scale.
10 cm = 100 mm; 4 in = 101.6 mm
Printing patterns at full size addons/apparel/lib/print.jsExact- CadCraft
-
Full-size page
The page size and the placement of the pieces on a single full-size page.
w = (maxX − minX)·k + 2·margin; h = (maxY − minY)·k + 2·margin + 8; matrix = [k, 0, 0, k, margin − minX·k, margin − minY·k]
Printing patterns at full size addons/apparel/lib/print.js64-bit- CadCraft
-
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
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.