All cases covered Bresenham's line-algorithm [closed]
I need to check all pixels in a line, so I'm using Bresenham's algorithm to access each pixel in it. In particular I need to check if all pixels are located on valid pixel of a bitmap. This is the code: private void Bresenham(Point p1, Point p2, ref List<Point> track) { int dx = p2.X - p1.X; int dy = p2.Y - p1.Y; int swaps = 0; if (dy > dx) { Swap(ref dx, ref dy); swaps = 1; } int a = Math.Abs(dy); int b = -Math.Abs(dx); double d = 2*a + b; int x = p1.X; int y = p1.Y; color_track = Color.Blue; Check_Pixel(ref area, new Point(x,y)); track.Clear(); track.Add(new Point(x, y)); int s = 1; int q =