22 float ledsPerTurn =
static_cast<float>(input.
numLeds) / verticalSegments;
25 output.
height = verticalSegments;
35 for (uint16_t i = 0; i < input.
numLeds; ++i) {
37 float position =
static_cast<float>(i) / (input.
numLeds - 1);
41 float height = position * verticalSegments;
44 float circumference = fmodf(angle * circumferencePerTurn /
TWO_PI,
45 circumferencePerTurn);
48 output.
mapping.push_back({circumference, height});
55 float thetaStep = 0.5f / output.
width;
56 float hStep = 0.5f / output.
height;
59 float anglePerSegment = input.
totalAngle / verticalSegments;
62 for (uint16_t h = 0; h < output.
height; ++h) {
64 for (uint16_t w = 0; w < output.
width; ++w) {
65 vec2f sample = {0, 0};
67 for (uint8_t ssH = 0; ssH < 2; ++ssH) {
68 for (uint8_t ssW = 0; ssW < 2; ++ssW) {
70 (w + 0.5f + ssW * thetaStep) / output.
width;
71 float height = (h + 0.5f + ssH * hStep) / output.
height;
74 float corkscrewTheta =
75 theta *
TWO_PI + anglePerSegment * h;
76 float corkscrewH = height * verticalSegments;
79 float corkscrewCircumference = fmodf(
80 corkscrewTheta * circumferencePerTurn /
TWO_PI +
82 circumferencePerTurn);
85 sample.
x += corkscrewCircumference;
86 sample.
y += corkscrewH;
94 output.
mapping.push_back(sample);