[Processing] Unfolding columns

This is a really useful tool, thanks! It’s exactly the next step I intend to explore as I add more key frames. :slight_smile:

Yes, I’m using a linear point to point transform. I’ve been using PVector.lerp and a different variant I made that lerps the vertices as Polar coordinates. The visual difference is that of an arc vs line. Sometimes it’s subtle, but sometimes it doesn’t make much difference.

I’ve modified your code for the lerpVectors function (also applicable to others) like so:

PVector lerpVectors(float amt, PVector... vecs) {
  if (vecs.length==1) { 
    return vecs[0];
  }

  float spacing = 1.0/(vecs.length-1);
  int lhs = floor(amt / spacing);
  int rhs = ceil(amt / spacing);

  try {
    return PVector.lerp(vecs[lhs], vecs[rhs], amt%spacing/spacing);
  } catch(Exception e) {
    return PVector.lerp(vecs[constrain(lhs, 0, vecs.length-2)], vecs[constrain(rhs, 1, vecs.length-1)], amt);
  }
}

Just to accommodate for an out of bounds issue when indices point to exactly 0 or 1, or when you want to go beyond the [0,1] domain when you’re interpolating. I sometimes let the lerp amount go beyond 1 or 0 for unpredictable results that may turn out to be interesting.

I’m going to add more keyFrames (>2) in the future and tag you when I post the results.

1 Like