Big Stripey Truth All the patterns

The more, the merrier, they say, and that probably goes for patterns as well. Stripes got some more company, with gradients, concentric circles, and checkered patterns. And why constrain the number of colors in a pattern?

def color_at(point)
  g = grade(point)
  c = @pigments.count - 1
  p = g.floor % c
  a, b = @pigments[p..p + 1]
  a.interpolate(b, g % 1)

Most of the work getting the multicolor working was refactoring all the kinds of patterns I created before. Each kind of pattern implements their own version of the grade method, that converts a 3D point to a scalar value, and the the base class takes care of the rest. With that in place, extending patterns to taking other patterns as pigments, instead of just plain colors, should be an easy next step.

Discrete rings

def grade(point)
  Math.sqrt(point.x**2 + point.z**2).floor

Linear gradient

def grade(point)