Cells in grid crossed by a line ( PHP )

308 views Asked by At

I have a mesh of cells in memory. I know the width and height of the cells, X0,Y0, X1,Y1, X2,Y2. Given a line connecting (X1,Y1) to (X2,Y2) I would like a way to determine the cells crossed by this line. I have hashed the cells that should get sellected in my drawing. I would like an idea on how to solve this and i will build the implementation in PHP.

Grid with selected cells

0

There are 0 answers