Skip to content

Commit

Permalink
Pinwheel: Use sin/cos16_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon502 committed Feb 25, 2025
1 parent e7e0eb0 commit 80061e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ static void setPinwheelParameters(int i, int vW, int vH, int& startx, int& start
for (int k = 0; k < 2; k++) // angular steps for two consecutive rays
{
int angle = (i + k) * baseAngle + rotate;
cosVal[k] = (cos16(angle) * Fixed_Scale) >> 15; // step per pixel in fixed point, cos16 output is -0x7FFF to +0x7FFF
sinVal[k] = (sin16(angle) * Fixed_Scale) >> 15; // using explicit bit shifts as dividing negative numbers is not equivalent (rounding error is acceptable)
cosVal[k] = (cos16_t(angle) * Fixed_Scale) >> 15; // step per pixel in fixed point, cos16 output is -0x7FFF to +0x7FFF
sinVal[k] = (sin16_t(angle) * Fixed_Scale) >> 15; // using explicit bit shifts as dividing negative numbers is not equivalent (rounding error is acceptable)
}
startx = (vW * Fixed_Scale) / 2; // + cosVal[0] / 4; // starting position = center + 1/4 pixel (in fixed point)
starty = (vH * Fixed_Scale) / 2; // + sinVal[0] / 4;
Expand Down

0 comments on commit 80061e8

Please sign in to comment.