Merge pull request #146 from openlayers/2492

Improving precision in LinearRing::containsPoint
This commit is contained in:
Pierre GIRAUD
2012-01-16 23:30:58 -08:00
2 changed files with 105 additions and 1 deletions

View File

@@ -294,7 +294,7 @@ OpenLayers.Geometry.LinearRing = OpenLayers.Class(
var px = approx(point.x, digs);
var py = approx(point.y, digs);
function getX(y, x1, y1, x2, y2) {
return (((x1 - x2) * y) + ((x2 * y1) - (x1 * y2))) / (y1 - y2);
return (y - y2) * ((x2 - x1) / (y2 - y1)) + x2;
}
var numSeg = this.components.length - 1;
var start, end, x1, y1, x2, y2, cx, cy;