I'm using a self made matrix as some kind of map
def __init__(self, rows = 10, colls = 10):
self.matrixRC = []
for _ in range(rows):
self.matrixRC.append([2 for _ in range(colls)])
and I was wondering if there was an easy way to make a y = ax
line function tell me what spaces of my matrix it goes trough (without checking all the points on the line).
An other way to put the problem, how do i know what box of my millimeterpaper my line goes trough (it starts on an intersection of two of my millimeterpaper lines).
p.s. sorry if my explanation isn't to good.
Exmaple:
..........
..##....#.
........#.
..........
..........
..........
..........
ss........
ss........
..........
so here the place where I start looking is the place in-between the 4 's' and I'd like a function/algorithm which tells me if a line at a certain angle (I'm setting 0 at the top so to the right would be 90 or Pi/2 degrees) hits a square with a #
and preferably fighter the length of the line at that point of the location of the #
both are fine.