Currently, I'm working on a three.js project where I should select two boxes from a board and draw a straight line connecting them, then I must highlight all the boxes that the line intersects. My big question now is how to to find which boxes the line intersects?
Any help would be appreciated (piece of code, links, material suggestion, math formulas)
What I really needed in this case was bresenhams line algorithm, with this I can track all different points that the line crosses.
Found at https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/
Thanks Ivan and Diarmid, I know my code was a big mess and you tried to help me despite that.