diff --git a/src/ol/geom/flatgeom.js b/src/ol/geom/flatgeom.js index 14f129081f..d6ba281505 100644 --- a/src/ol/geom/flatgeom.js +++ b/src/ol/geom/flatgeom.js @@ -344,9 +344,9 @@ ol.geom.flat.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) { // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html var contains = false; - var x1 = flatCoordinates[offset]; - var y1 = flatCoordinates[offset + 1]; - for (offset += stride; offset < end; offset += stride) { + var x1 = flatCoordinates[end - stride]; + var y1 = flatCoordinates[end - stride + 1]; + for (; offset < end; offset += stride) { var x2 = flatCoordinates[offset]; var y2 = flatCoordinates[offset + 1]; var intersect = ((y1 > y) != (y2 > y)) && diff --git a/test/spec/ol/geom/polygon.test.js b/test/spec/ol/geom/polygon.test.js index 1f6e57089d..b547565ec3 100644 --- a/test/spec/ol/geom/polygon.test.js +++ b/test/spec/ol/geom/polygon.test.js @@ -1,5 +1,3 @@ -// FIXME why do the skip tests below fail? I don't understand! - goog.provide('ol.test.geom.Polygon'); @@ -291,7 +289,7 @@ describe('ol.geom.Polygon', function() { expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates); }); - it.skip('does not contain outside coordinates', function() { + it('does not contain outside coordinates', function() { expect(polygon.containsCoordinate(outsideOuter)).to.be(false); }); @@ -304,10 +302,6 @@ describe('ol.geom.Polygon', function() { expect(polygon.containsCoordinate(insideInner2)).to.be(false); }); - it.skip('fails in strange ways', function() { - expect(polygon.containsCoordinate([0, 0])).to.be(false); - }); - }); describe('with a simple polygon', function() {