VHTransform.distance error

From: Chinh Tang <ctang@teloptica.com>
Date: Mon Sep 10 2001 - 18:11:13 EDT

Hi all,
I guess not many people use this function so the error was not found earlier.

The distance method in VHTransform looks like this.

    /** Return the distance in miles between 2 VH pairs. **/
    public static double distance
    (double v1, double h1, double v2, double h2) {
 double dv = v2 - v1;
    double dh = h2 - h1;
    return Math.sqrt(dv*dv + dh*dh)/10.0; }

The error is in the last line.
It should divid by 10 before doing sqrt like this
return Math.sqrt((dv*dv + dh*dh)/10);

for
VH(8426,4049) Dallas,TX
VH(8996,3992) Austin,TX
the old formula returns 57.8miles
the correct formula returns 181miles which is close enough if we started with
correct VH

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Sep 10 18:11:30 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT