Re: computing a straight line through a grid

From: Rasdan (rasdan@PEAK.ORG)
Date: 08/24/97


On Sat, 23 Aug 1997, Gary Barnett wrote:

> I've been stumped trying to find a fast way to do the following calculations.
>
> Given the following grid: (10x10)
>
>   A B C D E F G H I J
> 0 . . . . . . . . . .
> 1 . . . . . . . . . .
> 2 . . . . . . . . . .
> 3 . . . . . . . . . .
> 4 . . . . . . . . . .
> 5 . . . . . . . . . .
> 6 . . . . . . . . . .
> 7 . . . . . . . . . .
> 8 . . . . . . . . . .
> 9 . . . . . . . . . .
>
>
> What kind of a routine would you create if you needed to perform the
> following actions?
>
> 1) A straight line computation from one spot to another for the purposes
>    of determining if there are any obstacles in the way (mobs, objs, terrain)
Include math.h and use the pythagorean theorem, it's what we do for a
similar type thing, and it's quite fast.

Rasdan

=--=--=--=--=--=--=--=--=--=--=
  I have done so much,
  with so little,                         James C. Thomas Jr.
  for so long,                                 Rasdan
  That I can do anything                Head Coder of Finality!
  with nothing.
=--=--=--=--=--=--=--=--=--=--=
Finality is based upon CircleMUD 3.0, check us out:
                   finality.mudservices.com 5555


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST