bugfix for holes in 2D DNA Spiral

Holes were visible at height > 32. Root cause: "lerp8x8" seems to be inaccurate --> replaced by a simple linear calculation.
This commit is contained in:
Frank 2024-10-02 16:34:36 +02:00 committed by GitHub
parent 262af0678f
commit 402fba734a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5010,9 +5010,11 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
// draw a gradient line between x and x1
x = x / 2; x1 = x1 / 2;
unsigned steps = abs8(x - x1) + 1;
bool positive = (x1 >= x); // direction of drawing
for (size_t k = 1; k <= steps; k++) {
unsigned rate = k * 255 / steps;
unsigned dx = lerp8by8(x, x1, rate);
//unsigned dx = lerp8by8(x, x1, rate);
unsigned dx = positive? (x + k-1) : (x - k+1); // behaves the same as "lerp8by8" but does not create holes
//SEGMENT.setPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND).nscale8_video(rate));
SEGMENT.addPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND)); // use setPixelColorXY for different look
SEGMENT.fadePixelColorXY(dx, i, rate);