Use consistent variable names
This commit is contained in:
@@ -156,18 +156,18 @@ ol.geom.flat.linearRingContainsXY =
|
|||||||
function(flatCoordinates, offset, end, stride, x, y) {
|
function(flatCoordinates, offset, end, stride, x, y) {
|
||||||
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||||
var contains = false;
|
var contains = false;
|
||||||
var xi = flatCoordinates[offset];
|
var x1 = flatCoordinates[offset];
|
||||||
var yi = flatCoordinates[offset + 1];
|
var y1 = flatCoordinates[offset + 1];
|
||||||
for (offset += stride; offset < end; offset += stride) {
|
for (offset += stride; offset < end; offset += stride) {
|
||||||
var xj = flatCoordinates[offset];
|
var x2 = flatCoordinates[offset];
|
||||||
var yj = flatCoordinates[offset + 1];
|
var y2 = flatCoordinates[offset + 1];
|
||||||
var intersect = ((yi > y) != (yj > y)) &&
|
var intersect = ((y1 > y) != (y2 > y)) &&
|
||||||
(x < (xj - xi) * (y - yi) / (yj - yi) + xi);
|
(x < (x2 - x1) * (y - y1) / (y2 - y1) + x1);
|
||||||
if (intersect) {
|
if (intersect) {
|
||||||
contains = !contains;
|
contains = !contains;
|
||||||
}
|
}
|
||||||
xi = xj;
|
x1 = x2;
|
||||||
yi = yj;
|
y1 = y2;
|
||||||
}
|
}
|
||||||
return contains;
|
return contains;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user