// Rounded custom tatami — airy swirl-grain fill in a circle
// The rows follow a curved direction field (they arc and turn around
// the centre) and sit far apart for an open, decorative texture.

seed 42
fabric 'woven'

// --- vortex ---
let disc_r = 42                        // [20:1:46] circle radius, mm
let twist = 12                         // [0:1:40] outward tilt, degrees
let row_gap = 1.2                      // [0.6:0.1:2.4] tatami row gap, mm

// direction channel: rounded swirl grain:
// tangent-to-circles heading, tipped 25 deg outward so each row
// spirals gently instead of closing on itself
def swirl(p) [
  if vlen(p) < 1 [ return 90 ]         // dodge the singular centre
  return vheading(vrot(p, 90)) + twist
]

// shape channel: big-gap tatami rows:
def airy(p, row, v) [
  return tatamirow(row_gap, 2)          // open decorative rows
  // graded alternative — gaps widen toward one side:
  // return tatamirow(remap(v, 0, 1, 1.2, 2.4), 3)
]

fillunderlay 'off'                     // open fill: underlay would show through
fill dir @swirl shape @airy            // arm the next beginfill

up moveto 0 disc_r down
seth 90
beginfill
  circle disc_r                        // the region: a circle around origin
endfill
trim

// outline ring for a crisp edge:
bean 2
up moveto 0 disc_r down
seth 90
circle disc_r
trim
bean 1
