Closed ManDeJan closed 3 years ago
link to code
uint_fast16_t Dx = x1 - x0; uint_fast16_t Dy = y1 - y0; uint_fast16_t steep = (abs(Dy) >= abs(Dx)); if( steep ){ swap( x0, y0 ); swap( x1, y1 ); // recompute Dx, Dy after swap Dx = x1 - x0; Dy = y1 - y0; } uint_fast16_t xstep = 1; if( Dx < 0 ){ xstep = -1; Dx = -Dx; } uint_fast16_t ystep = 1; if( Dy < 0 ){ ystep = -1; Dy = -Dy; }
First you declare Dx and Dy to be an unsigned integer, then you check if they're smaller than 0. This is always false and does nothing.
Dx and Dy were changed to signed,
link to code
First you declare Dx and Dy to be an unsigned integer, then you check if they're smaller than 0. This is always false and does nothing.