Input variables
| Variable | Meaning | Unit |
|---|---|---|
| sw | Swatch width | cm |
| sh | Swatch height | cm |
| mass | Dry swatch mass | g |
| w | Blanket width | cm |
| h | Blanket length | cm |
| extra | Additional yarn allowance | % |
| skein | Skein mass | g |
Equations
Area-scaled yarn · g
base = mass*w*h/(sw*sh)
Yarn including allowance · g
total = base*(1+extra/100)
Whole skeins · skeins
count = ceil(total/skein)
Notation
PI means π. ** means a power, sqrt means square root, and abs gives the absolute value. Trigonometric functions use radians. min and max select the smallest or largest argument.
ceil rounds upward, floor rounds downward, and round rounds to the nearest integer with halves toward positive infinity. roundup(value, step) rounds upward to the next multiple of the step; a zero step leaves the value unchanged.
Assumptions
- The swatch must use the same yarn, stitch, hook and approximate tension as the blanket.
- Borders, tassels and colorwork can require additional yarn beyond a generic allowance.
- Dry mass is more useful than wet mass.
- Whole-skein rounding does not account for different colors or dye lots.
Precision and verification
The tool uses ordinary double-precision numeric arithmetic. Output is displayed to at most four decimal places; measurement precision is usually much lower. Check the worked examples, your project’s specifications, and a real sample before committing material.