0

Get all numbers between two points on a graph

class Grid: def __init__(self, x, y): self.x = x self.y = y cols = 22 rows = 16 grid = [0 for i in range(cols)] for node in range(cols): grid[node] = [0 for node in range(rows)] for x in range(cols): for y in range(rows): grid[x][y] = Grid(x, y) and I have two random coordinates, for example, (3,1) and (5,1), how would I get all the numbers on the graph between those two points? PS: the points could also be like this : (1,3) and (1, 5)

16th Feb 2021, 5:04 PM
Kirill
Kirill - avatar
1 Resposta
0
I would recommend looking into the Bressingham line algorithm for this purpose.
16th Feb 2021, 5:15 PM
Wilbur Jaywright
Wilbur Jaywright - avatar