Cylinder pixel mapper design (instead of 2d Matrix)

Thank you – I think that first link, to Cylinder Pixel Map and specifically the reply by @Scruffynerf that you quoted is doing the same think I want to do – a cylinder comprised of zig-zagging columns of LEDs, and the once I have the math right, I can just use any 3D render call.

Pasting that here as code, from @Scruffynerf’s original post, and I think all I have to do is replace “strands” with 15 and pixPerRing with 11, and use that code in my 3d render function:

function (pixelCount) {
  var map = [];
  var strands = 16;
  var pixPerRing = 14;
    for (strand = 0; strand < strands; strand++) {
      for (i = 0; i < pixPerRing; i++) {
        c = strand / strands * Math.PI * 2
        if (strand % 2) {
          map.push([Math.cos(c), Math.sin(c), i ])
        } else {
          map.push([Math.cos(c), Math.sin(c), pixPerRing -1 - i ])
        }
      }
    }
  return map
  
}
2 Likes