The3DG

Grip · Test cube 28

Golf dimples

Round dimples packed in rows, like a golf ball.

Presented by BriI never let go of the plate. These never let go of your hand.
× 1.00
0.8 mm
135°
  • Too fine for a 0.4 mm nozzle: the narrowest part is about 0.6 mm (under 1.2 mm). Make it bigger.

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

Good for

Grips, balls, anything that wants a sporty touch.

Print notes

The rims between dimples are thin (about 0.6 mm): they print as soft edges. For crisp rims, use a size of 2 or more.

  • Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 0.8 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 golfDimples(U: number, V: number, p = 5.0, amp = 0.8) {
  const r = Math.floor(V / (p * 0.866));
  const off = mod(r, 2) * 0.5;
  const c = Math.floor(U / p - off);
  const s = U / p - off - c - 0.5;
  const t = V / (p * 0.866) - r - 0.5;
  return amp * (1 - dome((s / 0.44) ** 2 + (t / 0.5) ** 2));
}
The helpers it uses (mod, dome, 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);
}
/** A round bump: 1 in the middle (r2 = 0), 0 at the edge (r2 = 1). */
function dome(r2: number) {
  return Math.sqrt(clamp(1 - r2, 0, 1));
}
function clamp(x: number, lo: number, hi: number) {
  return Math.min(Math.max(x, lo), hi);
}

Printed

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