by nathan@[EMAIL PROTECTED]
(Nathan Mates)
Feb 15, 2007 at 03:42 PM
In article <1171442828.610278.297910@[EMAIL PROTECTED]
>,
Anush <itsanushshetty@[EMAIL PROTECTED]
> wrote:
>I have a square grid of unit size. If i have a line between any two
>points, how do i find out the number of the intersecting squares.
If you're trying to figure out which squares the line goes into,
you could just run a bresenham's algorithm, and count things. See
http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
, or do a
google search for it.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A.
Heinlein