Hello, I have a cylinder with a 218 led strip wrapping from the bottom in a spiral.

I have tried a couple of different maps, but not sure how best to choose one. Any thoughts?

Below are the two maps I am testing:

function (pixelCount) {
var map = [];
var layers = 24;
var pixPerRing = 9;
for (layer = 0; layer < layers; layer++) {
for (i = 0; i < pixPerRing; i++) {
c = i / pixPerRing * Math.PI * 2
map.push([Math.cos(c), Math.sin(c), layer])
}
}
return map
}

function (pixelCount) {
var map = [];
numloops=24;
for (i = 0; i < pixelCount; i++) {
c = i / pixelCount * Math.PI * 2*numloops
map.push([Math.cos(c), Math.sin(c),i/pixelCount])
}
return map
}

I would assume the second one will give better results in most cases due to the continuity of the z dimension. The first map may â€śripâ€ť if the strip is truly in a helix and a pattern swept something up Z.

One quick reminder that the world coordinates use the computer graphics convention where positive Y points down. If Iâ€™m remembering this correctly, it implies that your helix as defined will be wound clockwise when viewed from above and arranged with the first pixels on the bottom, at z=0.

Hi Jeff, thanks for the response!
My pixels are wound counter clockwize, starting at the bottom.
Would this map be correct then?

function (pixelCount) {
var map = [];
numloops=24;
for (i =pixelCount ; i >= 0; iâ€“) {
c = i / pixelCount * Math.PI * 2*numloops
map.push([Math.cos(c), Math.sin(c),i/pixelCount])
}
return map
}

Unfortunately no, because now itâ€™s counting down, from the top (last pixel to first) which would be Ok (the map would be fine, it doesnâ€™t care, the first map point is still zero pixel, second is one, and so on) but the Z is going from top (pixelcount/pixelcount or 1) down to (0/pixelcount or 0)

So there is a neat trick you can use to fix this:

Add a minus sign to i/pixelcountâ€¦
Then it would count from -1 to 0, and the PB will renormalize that to 0â€¦1

And you also want to stop at zero (i>0), not -1 (i>=0), in your loopâ€¦ Pixelcount is actually one bigger (so if pixelcount is 50, if you start at zero, youâ€™ll have 51 pixels if you include the last one. Vice versa, counting down, same problem)