The3DG

Knits & fabric · Test cube 35

Tartan

Wide and narrow bands crossing each other: plaid, in relief.

Presented by SpoolYarn comes on a spool too. I feel very at home here.
× 1.00
1.0 mm
135°
  • Prints well with a 0.4 mm nozzle.

25 mm, with your size and depth. Prints upright, no supports. About 4 MB.

Good for

Gift boxes and anything with a cozy, checked look.

Print notes

Flat-topped steps with straight sides: a two-color print (or a dry brush of paint) makes the plaid pop.

  • Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 1.0 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 tartan(U: number, V: number, amp = 1.0) {
  const band = (x: number) =>
    0.45 * (tri(x / 16) > 0.55 ? 1 : 0) +
    0.3 * (tri(x / 16 + 0.25) > 0.8 ? 1 : 0) +
    0.25 * (tri(x / 4) > 0.5 ? 1 : 0);
  return (amp * clamp(band(U) + band(V), 0, 1.2)) / 1.2;
}
The helpers it uses (tri, frac, clamp)
/** A triangle wave: 0..1..0. */
function tri(x: number) {
  return 1 - 2 * Math.abs(frac(x) - 0.5);
}
/** The fractional part, 0..1. */
function frac(x: number) {
  return x - Math.floor(x);
}
function clamp(x: number, lo: number, hi: number) {
  return Math.min(Math.max(x, lo), hi);
}

Printed

Test cube 35 is waiting for the printer. Its photo goes here.