[Chameleon-dev] [Bug 1207] New: ExtentHistory compareEntries() returning false on same extents

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Thu Nov 24 13:39:22 EST 2005


http://bugzilla.maptools.org/show_bug.cgi?id=1207

           Summary: ExtentHistory compareEntries() returning false on same
                    extents
           Product: Chameleon
           Version: 2.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: chameleon-dev at lists.maptools.org
        ReportedBy: mcgrawj at agr.gc.ca


The following is an exchange of emails to the chameleon users list and with 
Paul Spencer:

> 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


-----Original Message-----
From: Paul Spencer [mailto:pspencer at dmsolutions.ca] 
Sent: Thursday, November 24, 2005 1:29 PM
To: McGraw, Joanne
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] ExtentHistory compareEntries()

Joanne,
if you can come up with a way to use the tolerance in the evaluation  
in a reasonable way, please file a bug and we'll put your code in.
Cheers
Paul


Paul, 
I just went with these changes in compareEntries() (actually in the widget I'm 
extending ExtentHistory with so I don't lose it in future):

        //text minx
        $d = abs($e1[0] - $e2[0]);
        if (abs($d - ($w1 * $pw)) > $tolerance)
            return false;

        //text miny
        $d = abs($e1[1] - $e2[1]);
        if (abs($d - ($h1 * $ph)) > $tolerance)
            return false;

        //text maxx
        $d = abs($e1[2] - $e2[2]);
        if (abs($d - ($w1 * $pw)) > $tolerance)
            return false;

        //text maxy
        $d = abs($e1[3] - $e2[3]);
        if (abs($d - ($h1 * $ph)) > $tolerance)
            return false;

Whether it's reasonable or not, others can determine. It took care of my 
particular problem where the same extents were evaluating to be unequal.

Cheers,
jtm



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.


More information about the Chameleon-dev mailing list