At 8:58 PM +0100 7/11/02, Nicholas Clark wrote: >On Thu, Jul 11, 2002 at 10:52:31AM -0700, John Porter wrote: >> >> Dan Sugalski wrote: >> > Nicholas Clark: >> > > Unless I'm being thick, x" < y" whenever x < y for positive x >> > > and y (ie you don't need to take the square root of the >> > > hypotenuse to work out which hypotenuse is shorter. And all >> > > we're actually interested in which one is shorter, aren't we?) >> > >> > We can also be dumb and just compare a^2+b^2. >> >> Yes, that's exactly what Nick was saying. > >Wasn't that was Dan was saying? :-) [given his choice of words] <ducks>
Heh. I was saying the same thing Nick was (I think) because his superscript 2s came through as double-quotes for me. (At least I presume they're superscript 2s...) > > Assuming x and y are coordinates in a 2-d space, and that both are >> integers >= 0, why not just use what is affectionately called the >> "taxicab" metric: x+y? It is just as "valid" and even quicker to >> compute than the Euclidean metric sqrt(x^2 + y^2). > >I was thinking that the metric (x*x + y*y) would be fast to calculate, as >that's all we need for ordering. (or x*x + y*y* + z*z or however many >dimensions you happen to need) > >And I live in London, where we don't have a regular grid of streets, so >our taxis don't do what yours do. :-) >[And even if your taxis don't drive on a grid either, I suspect that they >don't drive on the left side of the road. And I'd hate to think what metric >they use, but it goes up after midnight and in the vicinity of Heathrow >Airport. I don't think we would want parrot method dispatch to do that] And most of my experience with taxicabs is in Boston and Manhattan. I'm not sure I want an algorithm that drives on the sidewalks, runs red lights, and chases pedestrians.... -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk