Re: Rail deserts
- From: Jarle H Knudsen <jhkn@xxxxxxxxx>
- Date: Sat, 3 Nov 2007 01:24:15 +0100
On Thu, 1 Nov 2007 17:26:38 +0000, Clive D. W. Feather wrote:
In article <cmdssep72kdm.fys9gktrs182.dlg@xxxxxxxxxx>, Jarle H Knudsen
<jhkn@xxxxxxxxx> writes
1 for each grid cell
2 best := infinity
3 for each station on the list
4 d := (distance from station to cell) squared
5 if d < best then best := d
6 cell value := sqrt (best)
Why does the distance need to be squared in line 4?
What is the formula for distance between two points on a Cartesian grid?
d = sqrt((x2 - x1)^2 + (y2 - y1)^2).
But that does not explain (to me) why you do d^2 in line 4.
--
jhk
.
- Follow-Ups:
- Re: Rail deserts
- From: Tim Woodall
- Re: Rail deserts
- References:
- Re: Rail deserts
- From: Clive D. W. Feather
- Re: Rail deserts
- Prev by Date: Re: DLR train makes a bit for freedom
- Next by Date: Re: DLR train makes a bit for freedom
- Previous by thread: Re: Rail deserts
- Next by thread: Re: Rail deserts
- Index(es):