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
-
Distance from a point to a segment
How far an inside point is from a boundary edge, in scaled (u, v).
t = clamp(((q − s₀)·d) ÷ |d|², 0, 1); distance = |q − s₀ − t·d|
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Body transform
Moves the mesh by the transform stored with the body.
p′ = s·(p · M) + t; mirrored when det(M)·s³ < 0
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Is the mesh closed
Decides whether the mesh is a closed solid: every edge used once in each direction.
key(a, b) = a × 2³² + b
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Volume and surface area of the mesh
The volume enclosed by the triangles and their total area.
V = Σ p · (q × r) ÷ 6; A = Σ |(q − p) × (r − p)| ÷ 2
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
One span of the curve
The 16 points of the curve between two neighboring outline points.
tᵢ₊₁ = tᵢ + max(√|pᵢ₊₁ − pᵢ|, 1e-9); point = three levels of linear interpolation between p₀ … p₃ at t
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Sampled path of one edge
The points of one seam edge from corner to corner.
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Length of a path
The length of a sampled edge or outline.
L = Σ |pᵢ − pᵢ₋₁|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Running length
The distance from the start of a path to each of its points.
cᵢ = cᵢ₋₁ + |pᵢ − pᵢ₋₁|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Point at a distance along a path
The point and direction at a given distance along a path (used to place notches).
k = (d − cᵢ₋₁) ÷ (cᵢ − cᵢ₋₁); point = a + (b − a)·k; tangent = (b − a) ÷ |b − a|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Nearest point of a path
The point of a path nearest to a given point, and its distance along the path.
k = clamp(((p − a)·v) ÷ |v|², 0, 1); q = a + v·k
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Area of an outline
The signed area inside a closed sampled outline.
A = Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ) ÷ 2
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Centroid of an outline
The middle of area of a closed outline (where the label goes by default).
kᵢ = xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ; a = Σ kᵢ; c = Σ (pᵢ + pᵢ₊₁)·kᵢ ÷ (3·a)
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Where two lines meet
The meeting point of two lines and where it lies along each.
den = r × s; u = ((c − a) × s) ÷ den; point = a + r·u
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Outline direction
Makes an outline run counter-clockwise.
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
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
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.