0

I have a 2d array, 256 by 256 full of 0's. This is then drawn onto a win app form canvas as if its pixels. I only have 2 colours, white and block, 0 and 1 resepectably. So each image looks like 0,0... 1,1.. 0,0 etc.

Now for what I'm stumped with; I have 2 x and y values. The first one represents the start of a stroke and the second the end. I need to find a way to 'draw' this in the 2d array I have. So that the final result is a black line between the 2 values.

B001ᛦ
  • 2,036
  • 6
  • 23
  • 31
  • What you're asking is more of a math question than a programming one. See if this helps. https://stackoverflow.com/questions/17692922/check-is-a-point-x-y-is-between-two-points-drawn-on-a-straight-line – Sach Jul 21 '20 at 22:00
  • There are lots of ways you could approach this. You're expect to _try_ something and ask for help with a _specific_ problem. That said, Bresenham line drawing is the academic "go to" algorithm. See marked duplicates and many others. – Peter Duniho Jul 21 '20 at 22:04

0 Answers0