Thread: Rail deserts
View Single Post
  #26   Report Post  
Old November 2nd 07, 11:24 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 Thu, 1 Nov 2007 17:26:38 +0000, Clive D. W. Feather wrote:

In article , Jarle H Knudsen
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