[OpenLayers-Trac] [OpenLayers] #1245: intersects code suffers due to floating point errors

OpenLayers trac at openlayers.org
Thu Jan 3 19:08:19 EST 2008


#1245: intersects code suffers due to floating point errors
-----------------------+----------------------------------------------------
 Reporter:  crschmidt  |       Owner:  tschaub    
     Type:  feature    |      Status:  new        
 Priority:  minor      |   Milestone:  2.6 Release
Component:  Geometry   |     Version:  2.5        
 Keywords:             |       State:             
-----------------------+----------------------------------------------------
 This code breaks:

 {{{
 features = wkt.read("POLYGON((-8239529.462853361
 4980952.065110421,-8224242.057199065 4980952.065110421,-8224242.057199065
 4988844.188279452,-8239529.462853361 4988844.188279452,-8239529.462853361
 4980952.065110421))");
 point = new OpenLayers.Geometry.Point(-8225445.94039435,
 4982695.78481786);
 features.geometry.intersects(point)
 }}}

 {{{
 19:05:36 < tschaub> yeah, -8224242.057199557 != -8224242.057199065
 19:06:00 < tschaub> guess the coordinates aren't big enough in the test
 cases
                     to run in to floating point issues
 19:06:19 < tschaub> the code is good - the floating point math is bad
 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/1245>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list