Knits & fabric · Test cube 2
Rib knit
The same stitch, narrower and taller: the stretchy columns of a sweater cuff.
Yarn comes on a spool too. I feel very at home here.
- Prints well with a 0.4 mm nozzle.
25 mm, with your size and depth. Prints upright, no supports. About 4 MB.
- Depth as written1.1 mm
- Narrowest partabout 2.2 mm
- Smallest size, 0.4 mm nozzle× 0.55
Good for
Cups, sleeves and anything round and tall.
Print notes
- Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 1.1 mm).
- Best on walls, printed upright. On a flat top, use thin layers (0.12 mm or less).
- Fade it out over the bottom 3 mm so the first layers are flat and stick to the plate.
- Not printed yet: these notes come from the geometry. The test cube will tell us more.
The formula
The real code this page runs: give it a point (U mm across, V mm up) and it returns the height there, in mm. Push the surface out by that much and the texture is real geometry.
function ribKnit(U: number, V: number) {
return stitches(U, V, 4.2, 6.8, 1.0);
}The helpers it uses (stitches, clamp, srand)
/** Packed V stitches: two plump leaning legs per cell, with the yarn's twist running along each. */
function stitches(U: number, V: number, sw: number, sh: number, amp: number) {
const row0 = Math.floor(V / sh);
const col0 = Math.floor(U / sw);
let h = 0;
for (const dr of [-1, 0, 1])
for (const dc of [-1, 0, 1]) {
const r = row0 + dr;
const c = col0 + dc;
const s = U / sw - (c + 0.5);
const t = V / sh - (r + 0.5);
const jx = 0.05 * srand(r, c, 1);
const jy = 0.05 * srand(r, c, 2);
const ja = 1 + 0.08 * srand(r, c, 3);
for (const side of [-1, 1]) {
const cx = side * 0.21 + jx;
const cy = 0.05 + jy;
let dx = side * 0.42;
let dy = 0.91;
const n = Math.hypot(dx, dy);
dx = dx / n;
dy = dy / n;
const u = (s - cx) * dx + (t - cy) * dy;
const w = -(s - cx) * dy + (t - cy) * dx;
const r2 = (u / 0.64) ** 2 + (w / 0.3) ** 2;
const bump = clamp(1 - r2, 0, 1) ** 0.5;
const ply = 1 - 0.1 * (0.5 + 0.5 * Math.sin(2 * Math.PI * (u * 4.0 + w * 2.0 * side)));
h = Math.max(h, amp * ja * bump * ply);
}
}
return h;
}function clamp(x: number, lo: number, hi: number) {
return Math.min(Math.max(x, lo), hi);
}/** Random in -1..1 for one crochet stitch. */
function srand(r: number, c: number, k: number) {
const x = Math.sin(r * 127.1 + c * 311.7 + k * 74.7) * 43758.5453;
return (x - Math.floor(x)) * 2 - 1;
}Printed
Test cube 2 is waiting for the printer. Its photo goes here.