Jump to content

Bresenham's Line Drawing Algorithm


william15

Recommended Posts

I am coding a browser based 2d tile military combat engine.  I need to implement a way to do Line of Sight (If you can see the enemy over the hills and terrain).  After a ton of searching I found Bresenham's Algorithm.  I would use it to find the coordinates of the tiles in the line between the units, and then use a 2 dimensional array to see if that tile blocks LOS.  I only have one problem, since it is used to draw lines, I can only find implementations of the necessary code in C etc, but not in PHP, any help/links you can give me would be much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/116083-bresenhams-line-drawing-algorithm/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.