[Chameleon] ExtentHistory compareEntries()

McGraw, Joanne mcgrawj at AGR.GC.CA
Wed Nov 23 11:34:36 EST 2005


Hello all,

In ExtentHistory's compareEntries(), the tolerance 0.005 is being used to evaluate whether or not there is a difference in the width and height but is not being used to limit differences between the various min/max extents. Should it be?

In a scenario I can duplicate, compareEntries() is comparing the two extents shown at the bottom of this email, considering them unequal and, therefore, adding another extents entry to the stack. Another extents entry that is the exact same as the one before it, but the code considers them different because it is evaluating the difference between the minx of $e1 and $e2 as: 

0.00000000488944351673 - 0.00000000325962901115 = 0.00000000162981450558

That value is really just the result of rounding errors in the math to get those two values. A more complete showing of the numbers that got me to them is below. 

So, should the tolerance be used to evaluate the differences between the coordinates, as well as for the width and height? I assume yes, simply because comparisons of real numbers are usually limited by a tolerance of some kind, even if it's just 0.001 (depending on your numbers' precision). If this should be entered as a bug or if anyone is aware of why no tolerance is being used in the evaluation, let me know. 

Cheers,
jtm


These first four are showing the values held in the identified element for the $e1 and then the $e2 extent arrays:

[23-Nov-2005 10:45:08] 0 1177671.43072 = 1177671.43072
[23-Nov-2005 10:45:08] 1 6299760.16495 = 6299760.16495
[23-Nov-2005 10:45:08] 2 1364643.55198 = 1364643.55198
[23-Nov-2005 10:45:08] 3 6392540.6704 = 6392540.6704

These are basically showing the results of the math to get to the point where the minx is being evaluated as different:

[23-Nov-2005 10:45:08] w1 = 186972.121257; w2 = 186972.121257; abs(w1 - w2) = 3.25962901115E-009; abs(w1 - w2)/w2 = 1.74337702821E-014; pw = 1.74337702821E-014; tolerance = 0.005
[23-Nov-2005 10:45:08] h1 = 92780.5054541; h2 = 92780.5054541; abs(h1 - h2) = 1.86264514923E-009; abs(h1 - h2)/h2 = 2.00758245508E-014; ph = 2.00758245508E-014; tolerance = 0.005
[23-Nov-2005 10:45:08] e1[0] = 1177671.43072; e2[0] = 1177671.43072; abs(e1[0] - e2[0]) = 4.88944351673E-009; w1 * pw = 3.25962901115E-009
[23-Nov-2005 10:45:08] minx = 4.88944351673E-009 > 3.25962901115E-009
[23-Nov-2005 10:45:08] returning false


Joanne T. McGraw
GIS Data Analyst / Analyste des données du SIG
Agriculture and Agri-Food Canada / Agriculture et Agroalimentaire Canada
Telephone/Téléphone: (613) 759-6103
Facsimile/Télécopieur: (613) 759-1937
960 Carling Ave, #1136
Ottawa, Ontario
K1A 0C6

mcgrawj at agr.gc.ca
 




More information about the Chameleon mailing list