Thread: Rail deserts
View Single Post
  #19   Report Post  
Old October 29th 07, 02:17 PM posted to uk.transport.london
Jarle H Knudsen Jarle H Knudsen is offline
external usenet poster
 
First recorded activity at LondonBanter: Feb 2006
Posts: 168
Default Rail deserts

On Mon, 29 Oct 2007 11:04:56 +0000, Clive D. W. Feather wrote:


The approach I've taken in the past is very simple. Start with a grid
representing the entire area (to make it easy, say 1000 x 1000 with one
unit on the grid being 100 metres). Set up a list of locations of all
the stations. Then:


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?

--
jhk