geojs 1.14.1 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/geo.js CHANGED
@@ -26745,6 +26745,11 @@ var _quadFeature = function quadFeature(arg) {
26745
26745
  coordbasis.y = 1 - coordbasis.y;
26746
26746
  }
26747
26747
  if (coordbasis) {
26748
+ if (quad.crop && quad.crop.x !== undefined && quad.crop.y !== undefined && (coordbasis.x >= quad.crop.x || coordbasis.y >= quad.crop.y)) {
26749
+ indices.pop();
26750
+ found.pop();
26751
+ return;
26752
+ }
26748
26753
  extra[quad.idx] = {
26749
26754
  basis: coordbasis,
26750
26755
  _quad: quad
@@ -28164,7 +28169,7 @@ module.exports = _sceneObject;
28164
28169
  * @constant
28165
28170
  * @type {string}
28166
28171
  */
28167
- module.exports = "81c2c67b6f61c4292a790edab5e583c82095b099";
28172
+ module.exports = "8e2a6bf94ba85a370a33f2144165d89dd6061439";
28168
28173
 
28169
28174
  /***/ }),
28170
28175
 
@@ -32855,6 +32860,8 @@ var _trackFeature = function trackFeature(arg) {
32855
32860
  highidx = testidx;
32856
32861
  }
32857
32862
  }
32863
+ // todo: if we want non-linear travel between points, we would adjust
32864
+ // fl and fh here
32858
32865
  var fh = (time - lowt) / (hight - lowt),
32859
32866
  fl = 1 - fh;
32860
32867
  return {
@@ -40049,7 +40056,7 @@ module.exports = _vectorFeature;
40049
40056
  * @constant
40050
40057
  * @type {string}
40051
40058
  */
40052
- module.exports = "1.14.1";
40059
+ module.exports = "1.14.2";
40053
40060
 
40054
40061
  /***/ }),
40055
40062
 
@@ -76675,14 +76682,14 @@ function isEar(ear) {
76675
76682
  by = b.y,
76676
76683
  cy = c.y;
76677
76684
 
76678
- // triangle bbox; min & max are calculated like this for speed
76679
- var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
76680
- y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
76681
- x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
76682
- y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
76685
+ // triangle bbox
76686
+ var x0 = Math.min(ax, bx, cx),
76687
+ y0 = Math.min(ay, by, cy),
76688
+ x1 = Math.max(ax, bx, cx),
76689
+ y1 = Math.max(ay, by, cy);
76683
76690
  var p = c.next;
76684
76691
  while (p !== a) {
76685
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76692
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76686
76693
  p = p.next;
76687
76694
  }
76688
76695
  return true;
@@ -76700,11 +76707,11 @@ function isEarHashed(ear, minX, minY, invSize) {
76700
76707
  by = b.y,
76701
76708
  cy = c.y;
76702
76709
 
76703
- // triangle bbox; min & max are calculated like this for speed
76704
- var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
76705
- y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
76706
- x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
76707
- y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
76710
+ // triangle bbox
76711
+ var x0 = Math.min(ax, bx, cx),
76712
+ y0 = Math.min(ay, by, cy),
76713
+ x1 = Math.max(ax, bx, cx),
76714
+ y1 = Math.max(ay, by, cy);
76708
76715
 
76709
76716
  // z-order range for the current triangle bbox;
76710
76717
  var minZ = zOrder(x0, y0, minX, minY, invSize),
@@ -76714,21 +76721,21 @@ function isEarHashed(ear, minX, minY, invSize) {
76714
76721
 
76715
76722
  // look for points inside the triangle in both directions
76716
76723
  while (p && p.z >= minZ && n && n.z <= maxZ) {
76717
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76724
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76718
76725
  p = p.prevZ;
76719
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
76726
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
76720
76727
  n = n.nextZ;
76721
76728
  }
76722
76729
 
76723
76730
  // look for remaining points in decreasing z-order
76724
76731
  while (p && p.z >= minZ) {
76725
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76732
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
76726
76733
  p = p.prevZ;
76727
76734
  }
76728
76735
 
76729
76736
  // look for remaining points in increasing z-order
76730
76737
  while (n && n.z <= maxZ) {
76731
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
76738
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
76732
76739
  n = n.nextZ;
76733
76740
  }
76734
76741
  return true;
@@ -76789,7 +76796,7 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
76789
76796
  if (list === list.next) list.steiner = true;
76790
76797
  queue.push(getLeftmost(list));
76791
76798
  }
76792
- queue.sort(compareX);
76799
+ queue.sort(compareXYSlope);
76793
76800
 
76794
76801
  // process holes from left to right
76795
76802
  for (var _i2 = 0; _i2 < queue.length; _i2++) {
@@ -76797,8 +76804,19 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
76797
76804
  }
76798
76805
  return outerNode;
76799
76806
  }
76800
- function compareX(a, b) {
76801
- return a.x - b.x;
76807
+ function compareXYSlope(a, b) {
76808
+ var result = a.x - b.x;
76809
+ // when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find
76810
+ // the bridge to the outer shell is always the point that they meet at.
76811
+ if (result === 0) {
76812
+ result = a.y - b.y;
76813
+ if (result === 0) {
76814
+ var aSlope = (a.next.y - a.y) / (a.next.x - a.x);
76815
+ var bSlope = (b.next.y - b.y) / (b.next.x - b.x);
76816
+ result = aSlope - bSlope;
76817
+ }
76818
+ }
76819
+ return result;
76802
76820
  }
76803
76821
 
76804
76822
  // find a bridge between vertices that connects hole with an outer ring and and link it
@@ -76824,8 +76842,10 @@ function findHoleBridge(hole, outerNode) {
76824
76842
 
76825
76843
  // find a segment intersected by a ray from the hole's leftmost point to the left;
76826
76844
  // segment's endpoint with lesser x will be potential connection point
76845
+ // unless they intersect at a vertex, then choose the vertex
76846
+ if (equals(hole, p)) return p;
76827
76847
  do {
76828
- if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
76848
+ if (equals(hole, p.next)) return p.next;else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
76829
76849
  var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
76830
76850
  if (x <= hx && x > qx) {
76831
76851
  qx = x;
@@ -76954,6 +76974,11 @@ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
76954
76974
  return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
76955
76975
  }
76956
76976
 
76977
+ // check if a point lies within a convex triangle but false if its equal to the first point of the triangle
76978
+ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
76979
+ return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);
76980
+ }
76981
+
76957
76982
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
76958
76983
  function isValidDiagonal(a, b) {
76959
76984
  return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (
package/geo.lean.js CHANGED
@@ -23744,6 +23744,11 @@ var _quadFeature = function quadFeature(arg) {
23744
23744
  coordbasis.y = 1 - coordbasis.y;
23745
23745
  }
23746
23746
  if (coordbasis) {
23747
+ if (quad.crop && quad.crop.x !== undefined && quad.crop.y !== undefined && (coordbasis.x >= quad.crop.x || coordbasis.y >= quad.crop.y)) {
23748
+ indices.pop();
23749
+ found.pop();
23750
+ return;
23751
+ }
23747
23752
  extra[quad.idx] = {
23748
23753
  basis: coordbasis,
23749
23754
  _quad: quad
@@ -25163,7 +25168,7 @@ module.exports = _sceneObject;
25163
25168
  * @constant
25164
25169
  * @type {string}
25165
25170
  */
25166
- module.exports = "81c2c67b6f61c4292a790edab5e583c82095b099";
25171
+ module.exports = "8e2a6bf94ba85a370a33f2144165d89dd6061439";
25167
25172
 
25168
25173
  /***/ }),
25169
25174
 
@@ -29854,6 +29859,8 @@ var _trackFeature = function trackFeature(arg) {
29854
29859
  highidx = testidx;
29855
29860
  }
29856
29861
  }
29862
+ // todo: if we want non-linear travel between points, we would adjust
29863
+ // fl and fh here
29857
29864
  var fh = (time - lowt) / (hight - lowt),
29858
29865
  fl = 1 - fh;
29859
29866
  return {
@@ -37048,7 +37055,7 @@ module.exports = _vectorFeature;
37048
37055
  * @constant
37049
37056
  * @type {string}
37050
37057
  */
37051
- module.exports = "1.14.1";
37058
+ module.exports = "1.14.2";
37052
37059
 
37053
37060
  /***/ }),
37054
37061
 
@@ -73694,14 +73701,14 @@ function isEar(ear) {
73694
73701
  by = b.y,
73695
73702
  cy = c.y;
73696
73703
 
73697
- // triangle bbox; min & max are calculated like this for speed
73698
- var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
73699
- y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
73700
- x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
73701
- y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
73704
+ // triangle bbox
73705
+ var x0 = Math.min(ax, bx, cx),
73706
+ y0 = Math.min(ay, by, cy),
73707
+ x1 = Math.max(ax, bx, cx),
73708
+ y1 = Math.max(ay, by, cy);
73702
73709
  var p = c.next;
73703
73710
  while (p !== a) {
73704
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73711
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73705
73712
  p = p.next;
73706
73713
  }
73707
73714
  return true;
@@ -73719,11 +73726,11 @@ function isEarHashed(ear, minX, minY, invSize) {
73719
73726
  by = b.y,
73720
73727
  cy = c.y;
73721
73728
 
73722
- // triangle bbox; min & max are calculated like this for speed
73723
- var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
73724
- y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
73725
- x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
73726
- y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
73729
+ // triangle bbox
73730
+ var x0 = Math.min(ax, bx, cx),
73731
+ y0 = Math.min(ay, by, cy),
73732
+ x1 = Math.max(ax, bx, cx),
73733
+ y1 = Math.max(ay, by, cy);
73727
73734
 
73728
73735
  // z-order range for the current triangle bbox;
73729
73736
  var minZ = zOrder(x0, y0, minX, minY, invSize),
@@ -73733,21 +73740,21 @@ function isEarHashed(ear, minX, minY, invSize) {
73733
73740
 
73734
73741
  // look for points inside the triangle in both directions
73735
73742
  while (p && p.z >= minZ && n && n.z <= maxZ) {
73736
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73743
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73737
73744
  p = p.prevZ;
73738
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
73745
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
73739
73746
  n = n.nextZ;
73740
73747
  }
73741
73748
 
73742
73749
  // look for remaining points in decreasing z-order
73743
73750
  while (p && p.z >= minZ) {
73744
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73751
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
73745
73752
  p = p.prevZ;
73746
73753
  }
73747
73754
 
73748
73755
  // look for remaining points in increasing z-order
73749
73756
  while (n && n.z <= maxZ) {
73750
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
73757
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
73751
73758
  n = n.nextZ;
73752
73759
  }
73753
73760
  return true;
@@ -73808,7 +73815,7 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
73808
73815
  if (list === list.next) list.steiner = true;
73809
73816
  queue.push(getLeftmost(list));
73810
73817
  }
73811
- queue.sort(compareX);
73818
+ queue.sort(compareXYSlope);
73812
73819
 
73813
73820
  // process holes from left to right
73814
73821
  for (var _i2 = 0; _i2 < queue.length; _i2++) {
@@ -73816,8 +73823,19 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
73816
73823
  }
73817
73824
  return outerNode;
73818
73825
  }
73819
- function compareX(a, b) {
73820
- return a.x - b.x;
73826
+ function compareXYSlope(a, b) {
73827
+ var result = a.x - b.x;
73828
+ // when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find
73829
+ // the bridge to the outer shell is always the point that they meet at.
73830
+ if (result === 0) {
73831
+ result = a.y - b.y;
73832
+ if (result === 0) {
73833
+ var aSlope = (a.next.y - a.y) / (a.next.x - a.x);
73834
+ var bSlope = (b.next.y - b.y) / (b.next.x - b.x);
73835
+ result = aSlope - bSlope;
73836
+ }
73837
+ }
73838
+ return result;
73821
73839
  }
73822
73840
 
73823
73841
  // find a bridge between vertices that connects hole with an outer ring and and link it
@@ -73843,8 +73861,10 @@ function findHoleBridge(hole, outerNode) {
73843
73861
 
73844
73862
  // find a segment intersected by a ray from the hole's leftmost point to the left;
73845
73863
  // segment's endpoint with lesser x will be potential connection point
73864
+ // unless they intersect at a vertex, then choose the vertex
73865
+ if (equals(hole, p)) return p;
73846
73866
  do {
73847
- if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
73867
+ if (equals(hole, p.next)) return p.next;else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
73848
73868
  var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
73849
73869
  if (x <= hx && x > qx) {
73850
73870
  qx = x;
@@ -73973,6 +73993,11 @@ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
73973
73993
  return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
73974
73994
  }
73975
73995
 
73996
+ // check if a point lies within a convex triangle but false if its equal to the first point of the triangle
73997
+ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
73998
+ return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);
73999
+ }
74000
+
73976
74001
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
73977
74002
  function isValidDiagonal(a, b) {
73978
74003
  return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (