On Feb 15, 8:42 pm, nat...@[EMAIL PROTECTED]
(Nathan Mates) wrote:
> In article <1171442828.610278.297...@[EMAIL PROTECTED]
>,
>
> Anush <itsanushshe...@[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.
Seehttp://en.wikipedia.org/wiki/Bresenham's_line_algorithm,
or do a
> google search for it.
>
> Nathan Mates
> --
> <*> Nathan Mates - personal webpagehttp://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
I think Bresenham's algorithm is the best best :)
-
Anush


|