On Thu, 10 Jan 2002, Ray Seals wrote: > I've been looking for either a perl script or module to help me > calculate the distance between 2 coordinates. Does anyone have any > ideas or scripts?
There is a simple vector algebra algorithm for this: If you have two points, p and q p(a, b) q(c, d) the distance between p and q is the square root of the sum of the squares of the differences between corresponding components: d(p, q) = sqrt( (a - c )**2 + (b - d)**2 ) This applies to points of N-dimensions: p(a1, a2, ... aN) q(b1, b2, ... bN) d(p, q) = sqrt( (a1 - b1)**2 + (a2 - b2)**2 + ... (aN - bN)**2 ) -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ Wharbat darbid yarbou sarbay? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]