The3DG

Nature · Test cube 40

Flowers

A five-petal flower in every square, each turned its own way.

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

Gifts, planters, kids’ things.

Print notes

  • 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 flowers(U: number, V: number, p = 10.0, amp = 1.0) {
  const i = Math.floor(U / p);
  const j = Math.floor(V / p);
  const s = frac(U / p) - 0.5;
  const t = frac(V / p) - 0.5;
  const a = Math.atan2(t, s) + 6.3 * rnd(i, j, 21); // each flower turned its own way
  const r = Math.hypot(s, t);
  const edge = 0.24 + 0.12 * Math.cos(5 * a); // five petals
  return amp * clamp((edge - r) / 0.05, 0, 1);
}
The helpers it uses (frac, clamp, rnd)
/** 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);
}
/** A repeatable random number 0..1 for a cell (no Math.random: the same texture every time). */
function rnd(a: number, b: number, k = 0) {
  const x = Math.sin(a * 127.1 + b * 311.7 + k * 74.7) * 43758.5453;
  return x - Math.floor(x);
}

Printed

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