The3DG

Nature · Test cube 7

Scales

Rounded scales in staggered rows, each one overlapping the row below.

Presented by FloNothing in nature repeats exactly. Neither do these. Relax into it.
× 1.00
1.3 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

Dragons, fish, armor and mermaid-tail pots.

Print notes

  • Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 1.3 mm).
  • It has an up and a down: print it on a wall the way it is drawn here (the top of the picture is up).
  • 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 scales(U: number, V: number, w = 8.0, amp = 1.3) {
  const r = Math.floor(V / (w * 0.55));
  let h = 0;
  for (const dr of [0, -1]) {
    // each scale overlaps the row below
    const rr = r + dr;
    const o = mod(rr, 2) * 0.5;
    const c = Math.floor(U / w - o);
    const s = U / w - o - c - 0.5;
    const t = V / (w * 0.55) - rr;
    const d = Math.sqrt((s / 0.55) ** 2 + ((t - 0.1) / 0.95) ** 2);
    h = Math.max(h, d < 1 ? amp * Math.max(1 - d, 0) ** 0.4 * clamp(1.4 - t, 0, 1) : 0);
  }
  return h;
}
The helpers it uses (mod, clamp)
/** Python's floor modulo: the result has the sign of b (`-1 % 2` is 1, as in numpy). */
function mod(a: number, b: number) {
  return a - b * Math.floor(a / b);
}
function clamp(x: number, lo: number, hi: number) {
  return Math.min(Math.max(x, lo), hi);
}

Printed

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