Reputation: 9538
I have a 2D array consisting of 0s and 1s. I have a vector originating from a 0 to any direction and I need to find the nearest 1 that intersects with the vector in that direction and its distance
So I've looked into ray tracing, but most materials on the subject seemed rather unintuitive and mostly talked about how to do refraction and color calculations.
Is there something simpler than the said algorithm?
Thanks.
Upvotes: 1
Views: 396
Reputation: 66
You can adapt the Bresenham' line algorithm to this task.
Upvotes: 3