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

  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • Do two pieces overlap

    Whether two placed pieces overlap.

    Markers: pieces laid on fabric addons/apparel/lib/marker.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • Reading a RUL file

    The sizes, sample size and rules of a rule file.

    DXF-AAMA and ASTM pattern files addons/apparel/lib/aama.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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 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.