@maplat/tin 1.1.1-rc.1 → 1.1.2-rc.1
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/README.ja.md +6 -6
- package/README.md +6 -6
- package/dist/boundary-vertices.d.ts +1 -1
- package/dist/edgebound/constrain.d.ts +23 -2
- package/dist/edgebound/index.d.ts +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/kinks.d.ts +20 -0
- package/dist/maplat_tin.js +1536 -1434
- package/dist/maplat_tin.umd.js +3 -3
- package/dist/strict-overlap.d.ts +1 -1
- package/dist/tin.d.ts +5 -2
- package/dist/types/kinks.d.ts +12 -0
- package/dist/types/tin.d.ts +49 -0
- package/package.json +6 -7
- package/src/boundary-vertices.ts +1 -1
- package/src/constrained-tin.ts +1 -1
- package/src/edgebound/constrain.ts +74 -0
- package/src/index.ts +2 -2
- package/src/kinks.ts +76 -42
- package/src/tin.ts +42 -5
- package/src/types/kinks.ts +24 -0
- package/src/types/kinks.d.ts +0 -51
- /package/src/types/{tin.d.ts → tin.ts} +0 -0
package/dist/maplat_tin.js
CHANGED
|
@@ -2,7 +2,7 @@ function oe(e, t, n = {}) {
|
|
|
2
2
|
const i = { type: "Feature" };
|
|
3
3
|
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = t || {}, i.geometry = e, i;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function Rt(e, t, n = {}) {
|
|
6
6
|
if (!e)
|
|
7
7
|
throw new Error("coordinates is required");
|
|
8
8
|
if (!Array.isArray(e))
|
|
@@ -41,14 +41,14 @@ function He(e, t, n = {}) {
|
|
|
41
41
|
coordinates: e
|
|
42
42
|
}, t, n);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Et(e, t = {}) {
|
|
45
45
|
const n = { type: "FeatureCollection" };
|
|
46
46
|
return t.id && (n.id = t.id), t.bbox && (n.bbox = t.bbox), n.features = e, n;
|
|
47
47
|
}
|
|
48
48
|
function We(e) {
|
|
49
49
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function oi(e) {
|
|
52
52
|
if (!e)
|
|
53
53
|
throw new Error("coord is required");
|
|
54
54
|
if (!Array.isArray(e)) {
|
|
@@ -61,100 +61,100 @@ function ni(e) {
|
|
|
61
61
|
return [...e];
|
|
62
62
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function si(e) {
|
|
65
65
|
return e.type === "Feature" ? e.geometry : e;
|
|
66
66
|
}
|
|
67
67
|
function ze(e, t, n) {
|
|
68
68
|
if (e !== null)
|
|
69
|
-
for (var i, o, r, s, a,
|
|
70
|
-
|
|
69
|
+
for (var i, o, r, s, a, l, f, h = 0, c = 0, u, d = e.type, _ = d === "FeatureCollection", w = d === "Feature", O = _ ? e.features.length : 1, M = 0; M < O; M++) {
|
|
70
|
+
f = _ ? (
|
|
71
71
|
// @ts-expect-error: Known type conflict
|
|
72
|
-
e.features[
|
|
72
|
+
e.features[M].geometry
|
|
73
73
|
) : w ? (
|
|
74
74
|
// @ts-expect-error: Known type conflict
|
|
75
75
|
e.geometry
|
|
76
|
-
) : e,
|
|
76
|
+
) : e, u = f ? f.type === "GeometryCollection" : !1, a = u ? f.geometries.length : 1;
|
|
77
77
|
for (var m = 0; m < a; m++) {
|
|
78
|
-
var
|
|
79
|
-
if (s =
|
|
80
|
-
|
|
81
|
-
var
|
|
82
|
-
switch (
|
|
78
|
+
var v = 0, p = 0;
|
|
79
|
+
if (s = u ? f.geometries[m] : f, s !== null) {
|
|
80
|
+
l = s.coordinates;
|
|
81
|
+
var b = s.type;
|
|
82
|
+
switch (h = n && (b === "Polygon" || b === "MultiPolygon") ? 1 : 0, b) {
|
|
83
83
|
case null:
|
|
84
84
|
break;
|
|
85
85
|
case "Point":
|
|
86
86
|
if (
|
|
87
87
|
// @ts-expect-error: Known type conflict
|
|
88
88
|
t(
|
|
89
|
-
|
|
89
|
+
l,
|
|
90
90
|
c,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
M,
|
|
92
|
+
v,
|
|
93
|
+
p
|
|
94
94
|
) === !1
|
|
95
95
|
)
|
|
96
96
|
return !1;
|
|
97
|
-
c++,
|
|
97
|
+
c++, v++;
|
|
98
98
|
break;
|
|
99
99
|
case "LineString":
|
|
100
100
|
case "MultiPoint":
|
|
101
|
-
for (i = 0; i <
|
|
101
|
+
for (i = 0; i < l.length; i++) {
|
|
102
102
|
if (
|
|
103
103
|
// @ts-expect-error: Known type conflict
|
|
104
104
|
t(
|
|
105
|
-
|
|
105
|
+
l[i],
|
|
106
106
|
c,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
M,
|
|
108
|
+
v,
|
|
109
|
+
p
|
|
110
110
|
) === !1
|
|
111
111
|
)
|
|
112
112
|
return !1;
|
|
113
|
-
c++,
|
|
113
|
+
c++, b === "MultiPoint" && v++;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
b === "LineString" && v++;
|
|
116
116
|
break;
|
|
117
117
|
case "Polygon":
|
|
118
118
|
case "MultiLineString":
|
|
119
|
-
for (i = 0; i <
|
|
120
|
-
for (o = 0; o <
|
|
119
|
+
for (i = 0; i < l.length; i++) {
|
|
120
|
+
for (o = 0; o < l[i].length - h; o++) {
|
|
121
121
|
if (
|
|
122
122
|
// @ts-expect-error: Known type conflict
|
|
123
123
|
t(
|
|
124
|
-
|
|
124
|
+
l[i][o],
|
|
125
125
|
c,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
M,
|
|
127
|
+
v,
|
|
128
|
+
p
|
|
129
129
|
) === !1
|
|
130
130
|
)
|
|
131
131
|
return !1;
|
|
132
132
|
c++;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
b === "MultiLineString" && v++, b === "Polygon" && p++;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
b === "Polygon" && v++;
|
|
137
137
|
break;
|
|
138
138
|
case "MultiPolygon":
|
|
139
|
-
for (i = 0; i <
|
|
140
|
-
for (
|
|
141
|
-
for (r = 0; r <
|
|
139
|
+
for (i = 0; i < l.length; i++) {
|
|
140
|
+
for (p = 0, o = 0; o < l[i].length; o++) {
|
|
141
|
+
for (r = 0; r < l[i][o].length - h; r++) {
|
|
142
142
|
if (
|
|
143
143
|
// @ts-expect-error: Known type conflict
|
|
144
144
|
t(
|
|
145
|
-
|
|
145
|
+
l[i][o][r],
|
|
146
146
|
c,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
M,
|
|
148
|
+
v,
|
|
149
|
+
p
|
|
150
150
|
) === !1
|
|
151
151
|
)
|
|
152
152
|
return !1;
|
|
153
153
|
c++;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
p++;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
v++;
|
|
158
158
|
}
|
|
159
159
|
break;
|
|
160
160
|
case "GeometryCollection":
|
|
@@ -172,35 +172,35 @@ function ze(e, t, n) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
const pt = 11102230246251565e-32,
|
|
176
|
-
function
|
|
177
|
-
let r, s, a,
|
|
178
|
-
|
|
179
|
-
let
|
|
180
|
-
if (c < e &&
|
|
181
|
-
for (
|
|
182
|
-
|
|
175
|
+
const pt = 11102230246251565e-32, q = 134217729, Ln = (3 + 8 * pt) * pt;
|
|
176
|
+
function ht(e, t, n, i, o) {
|
|
177
|
+
let r, s, a, l, f = t[0], h = i[0], c = 0, u = 0;
|
|
178
|
+
h > f == h > -f ? (r = f, f = t[++c]) : (r = h, h = i[++u]);
|
|
179
|
+
let d = 0;
|
|
180
|
+
if (c < e && u < n)
|
|
181
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++c]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[d++] = a); c < e && u < n; )
|
|
182
|
+
h > f == h > -f ? (s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u]), r = s, a !== 0 && (o[d++] = a);
|
|
183
183
|
for (; c < e; )
|
|
184
|
-
s = r +
|
|
185
|
-
for (;
|
|
186
|
-
s = r +
|
|
187
|
-
return (r !== 0 ||
|
|
184
|
+
s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c], r = s, a !== 0 && (o[d++] = a);
|
|
185
|
+
for (; u < n; )
|
|
186
|
+
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u], r = s, a !== 0 && (o[d++] = a);
|
|
187
|
+
return (r !== 0 || d === 0) && (o[d++] = r), d;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
189
|
+
function Mt(e, t, n, i, o, r, s, a) {
|
|
190
|
+
return ht(ht(e, t, n, i, s), s, o, r, a);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
let o, r, s, a,
|
|
194
|
-
|
|
192
|
+
function R(e, t, n, i) {
|
|
193
|
+
let o, r, s, a, l, f, h, c, u, d, _;
|
|
194
|
+
h = q * n, d = h - (h - n), _ = n - d;
|
|
195
195
|
let w = t[0];
|
|
196
|
-
o = w * n,
|
|
197
|
-
let
|
|
198
|
-
s !== 0 && (i[
|
|
199
|
-
for (let
|
|
200
|
-
w = t[
|
|
201
|
-
return (o !== 0 ||
|
|
202
|
-
}
|
|
203
|
-
function
|
|
196
|
+
o = w * n, h = q * w, c = h - (h - w), u = w - c, s = u * _ - (o - c * d - u * d - c * _);
|
|
197
|
+
let O = 0;
|
|
198
|
+
s !== 0 && (i[O++] = s);
|
|
199
|
+
for (let M = 1; M < e; M++)
|
|
200
|
+
w = t[M], a = w * n, h = q * w, c = h - (h - w), u = w - c, l = u * _ - (a - c * d - u * d - c * _), r = o + l, f = r - o, s = o - (r - f) + (l - f), s !== 0 && (i[O++] = s), o = a + r, s = r - (o - a), s !== 0 && (i[O++] = s);
|
|
201
|
+
return (o !== 0 || O === 0) && (i[O++] = o), O;
|
|
202
|
+
}
|
|
203
|
+
function Vn(e, t) {
|
|
204
204
|
let n = t[0];
|
|
205
205
|
for (let i = 1; i < e; i++) n += t[i];
|
|
206
206
|
return n;
|
|
@@ -208,304 +208,304 @@ function $n(e, t) {
|
|
|
208
208
|
function tt(e) {
|
|
209
209
|
return new Float64Array(e);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
213
|
-
let a,
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
let
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
const T =
|
|
211
|
+
const ai = (3 + 16 * pt) * pt, ci = (2 + 12 * pt) * pt, li = (9 + 64 * pt) * pt * pt, zt = tt(4), Ze = tt(8), tn = tt(12), en = tt(16), mt = tt(4);
|
|
212
|
+
function fi(e, t, n, i, o, r, s) {
|
|
213
|
+
let a, l, f, h, c, u, d, _, w, O, M, m, v, p, b, g, E, S;
|
|
214
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
215
|
+
p = k * C, u = q * k, d = u - (u - k), _ = k - d, u = q * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * P, u = q * N, d = u - (u - N), _ = N - d, u = q * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, zt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, zt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, zt[2] = m - (S - c) + (M - c), zt[3] = S;
|
|
216
|
+
let F = Vn(4, zt), y = ci * s;
|
|
217
|
+
if (F >= y || -F >= y || (c = e - k, a = e - (k + c) + (c - o), c = n - P, f = n - (P + c) + (c - o), c = t - N, l = t - (N + c) + (c - r), c = i - C, h = i - (C + c) + (c - r), a === 0 && l === 0 && f === 0 && h === 0) || (y = li * s + Ln * Math.abs(F), F += k * h + C * a - (N * f + P * l), F >= y || -F >= y)) return F;
|
|
218
|
+
p = a * C, u = q * a, d = u - (u - a), _ = a - d, u = q * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * P, u = q * l, d = u - (u - l), _ = l - d, u = q * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, mt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, mt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, mt[2] = m - (S - c) + (M - c), mt[3] = S;
|
|
219
|
+
const I = ht(4, zt, 4, mt, Ze);
|
|
220
|
+
p = k * h, u = q * k, d = u - (u - k), _ = k - d, u = q * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * f, u = q * N, d = u - (u - N), _ = N - d, u = q * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, mt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, mt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, mt[2] = m - (S - c) + (M - c), mt[3] = S;
|
|
221
|
+
const A = ht(I, Ze, 4, mt, tn);
|
|
222
|
+
p = a * h, u = q * a, d = u - (u - a), _ = a - d, u = q * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * f, u = q * l, d = u - (u - l), _ = l - d, u = q * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, mt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, mt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, mt[2] = m - (S - c) + (M - c), mt[3] = S;
|
|
223
|
+
const T = ht(A, tn, 4, mt, en);
|
|
224
224
|
return en[T - 1];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
228
|
-
return Math.abs(
|
|
226
|
+
function Ot(e, t, n, i, o, r) {
|
|
227
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), l = s - a, f = Math.abs(s + a);
|
|
228
|
+
return Math.abs(l) >= ai * f ? l : -fi(e, t, n, i, o, r, f);
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
let Qt = tt(1152),
|
|
230
|
+
const hi = (10 + 96 * pt) * pt, ui = (4 + 48 * pt) * pt, di = (44 + 576 * pt) * pt * pt, Xt = tt(4), $t = tt(4), Dt = tt(4), kt = tt(4), At = tt(4), It = tt(4), gt = tt(4), wt = tt(4), Oe = tt(8), Pe = tt(8), Ne = tt(8), Be = tt(8), Te = tt(8), Ce = tt(8), ue = tt(8), de = tt(8), pe = tt(8), Lt = tt(4), Vt = tt(4), Ut = tt(4), z = tt(8), K = tt(16), nt = tt(16), it = tt(16), et = tt(32), Ft = tt(32), at = tt(48), bt = tt(64);
|
|
231
|
+
let Qt = tt(1152), Xe = tt(1152);
|
|
232
232
|
function ct(e, t, n) {
|
|
233
|
-
e =
|
|
233
|
+
e = ht(e, Qt, t, n, Xe);
|
|
234
234
|
const i = Qt;
|
|
235
|
-
return Qt =
|
|
236
|
-
}
|
|
237
|
-
function
|
|
238
|
-
let
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
return Qt = Xe, Xe = i, e;
|
|
236
|
+
}
|
|
237
|
+
function pi(e, t, n, i, o, r, s, a, l) {
|
|
238
|
+
let f, h, c, u, d, _, w, O, M, m, v, p, b, g, E, S, k, P, N, C, F, y, I, A, T, X, D, x, B, $, Y, L, V, j, U;
|
|
239
|
+
const G = e - s, J = n - s, Q = o - s, H = t - a, Z = i - a, W = r - a;
|
|
240
|
+
Y = J * W, I = q * J, A = I - (I - J), T = J - A, I = q * W, X = I - (I - W), D = W - X, L = T * D - (Y - A * X - T * X - A * D), V = Q * Z, I = q * Q, A = I - (I - Q), T = Q - A, I = q * Z, X = I - (I - Z), D = Z - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Xt[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, Xt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Xt[2] = B - (U - y) + (x - y), Xt[3] = U, Y = Q * H, I = q * Q, A = I - (I - Q), T = Q - A, I = q * H, X = I - (I - H), D = H - X, L = T * D - (Y - A * X - T * X - A * D), V = G * W, I = q * G, A = I - (I - G), T = G - A, I = q * W, X = I - (I - W), D = W - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, $t[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, $t[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, $t[2] = B - (U - y) + (x - y), $t[3] = U, Y = G * Z, I = q * G, A = I - (I - G), T = G - A, I = q * Z, X = I - (I - Z), D = Z - X, L = T * D - (Y - A * X - T * X - A * D), V = J * H, I = q * J, A = I - (I - J), T = J - A, I = q * H, X = I - (I - H), D = H - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Dt[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, Dt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Dt[2] = B - (U - y) + (x - y), Dt[3] = U, f = ht(
|
|
241
|
+
ht(
|
|
242
|
+
ht(
|
|
243
|
+
R(R(4, Xt, G, z), z, G, K),
|
|
244
244
|
K,
|
|
245
|
-
|
|
245
|
+
R(R(4, Xt, H, z), z, H, nt),
|
|
246
246
|
nt,
|
|
247
247
|
et
|
|
248
248
|
),
|
|
249
249
|
et,
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
ht(
|
|
251
|
+
R(R(4, $t, J, z), z, J, K),
|
|
252
252
|
K,
|
|
253
|
-
|
|
253
|
+
R(R(4, $t, Z, z), z, Z, nt),
|
|
254
254
|
nt,
|
|
255
|
-
|
|
255
|
+
Ft
|
|
256
256
|
),
|
|
257
|
-
|
|
257
|
+
Ft,
|
|
258
258
|
bt
|
|
259
259
|
),
|
|
260
260
|
bt,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
ht(
|
|
262
|
+
R(R(4, Dt, Q, z), z, Q, K),
|
|
263
263
|
K,
|
|
264
|
-
|
|
264
|
+
R(R(4, Dt, W, z), z, W, nt),
|
|
265
265
|
nt,
|
|
266
266
|
et
|
|
267
267
|
),
|
|
268
268
|
et,
|
|
269
269
|
Qt
|
|
270
270
|
);
|
|
271
|
-
let st =
|
|
272
|
-
if (st >=
|
|
271
|
+
let st = Vn(f, Qt), ft = ui * l;
|
|
272
|
+
if (st >= ft || -st >= ft || (y = e - G, h = e - (G + y) + (y - s), y = t - H, d = t - (H + y) + (y - a), y = n - J, c = n - (J + y) + (y - s), y = i - Z, _ = i - (Z + y) + (y - a), y = o - Q, u = o - (Q + y) + (y - s), y = r - W, w = r - (W + y) + (y - a), h === 0 && c === 0 && u === 0 && d === 0 && _ === 0 && w === 0) || (ft = di * l + Ln * Math.abs(st), st += (G * G + H * H) * (J * w + W * c - (Z * u + Q * _)) + 2 * (G * h + H * d) * (J * W - Z * Q) + ((J * J + Z * Z) * (Q * d + H * u - (W * h + G * w)) + 2 * (J * c + Z * _) * (Q * H - W * G)) + ((Q * Q + W * W) * (G * _ + Z * h - (H * c + J * d)) + 2 * (Q * u + W * w) * (G * Z - H * J)), st >= ft || -st >= ft))
|
|
273
273
|
return st;
|
|
274
|
-
if ((c !== 0 ||
|
|
275
|
-
|
|
274
|
+
if ((c !== 0 || _ !== 0 || u !== 0 || w !== 0) && (Y = G * G, I = q * G, A = I - (I - G), T = G - A, L = T * T - (Y - A * A - (A + A) * T), V = H * H, I = q * H, A = I - (I - H), T = H - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, kt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, kt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, kt[2] = B - (U - y) + (x - y), kt[3] = U), (u !== 0 || w !== 0 || h !== 0 || d !== 0) && (Y = J * J, I = q * J, A = I - (I - J), T = J - A, L = T * T - (Y - A * A - (A + A) * T), V = Z * Z, I = q * Z, A = I - (I - Z), T = Z - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, At[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, At[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, At[2] = B - (U - y) + (x - y), At[3] = U), (h !== 0 || d !== 0 || c !== 0 || _ !== 0) && (Y = Q * Q, I = q * Q, A = I - (I - Q), T = Q - A, L = T * T - (Y - A * A - (A + A) * T), V = W * W, I = q * W, A = I - (I - W), T = W - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, It[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, It[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, It[2] = B - (U - y) + (x - y), It[3] = U), h !== 0 && (O = R(4, Xt, h, Oe), f = ct(f, Mt(
|
|
275
|
+
R(O, Oe, 2 * G, K),
|
|
276
276
|
K,
|
|
277
|
-
|
|
277
|
+
R(R(4, It, h, z), z, Z, nt),
|
|
278
278
|
nt,
|
|
279
|
-
|
|
279
|
+
R(R(4, At, h, z), z, -W, it),
|
|
280
280
|
it,
|
|
281
281
|
et,
|
|
282
282
|
at
|
|
283
|
-
), at)),
|
|
284
|
-
|
|
283
|
+
), at)), d !== 0 && (M = R(4, Xt, d, Pe), f = ct(f, Mt(
|
|
284
|
+
R(M, Pe, 2 * H, K),
|
|
285
285
|
K,
|
|
286
|
-
|
|
286
|
+
R(R(4, At, d, z), z, Q, nt),
|
|
287
287
|
nt,
|
|
288
|
-
|
|
288
|
+
R(R(4, It, d, z), z, -J, it),
|
|
289
289
|
it,
|
|
290
290
|
et,
|
|
291
291
|
at
|
|
292
|
-
), at)), c !== 0 && (m =
|
|
293
|
-
|
|
292
|
+
), at)), c !== 0 && (m = R(4, $t, c, Ne), f = ct(f, Mt(
|
|
293
|
+
R(m, Ne, 2 * J, K),
|
|
294
294
|
K,
|
|
295
|
-
|
|
295
|
+
R(R(4, kt, c, z), z, W, nt),
|
|
296
296
|
nt,
|
|
297
|
-
|
|
297
|
+
R(R(4, It, c, z), z, -H, it),
|
|
298
298
|
it,
|
|
299
299
|
et,
|
|
300
300
|
at
|
|
301
|
-
), at)),
|
|
302
|
-
|
|
301
|
+
), at)), _ !== 0 && (v = R(4, $t, _, Be), f = ct(f, Mt(
|
|
302
|
+
R(v, Be, 2 * Z, K),
|
|
303
303
|
K,
|
|
304
|
-
|
|
304
|
+
R(R(4, It, _, z), z, G, nt),
|
|
305
305
|
nt,
|
|
306
|
-
|
|
306
|
+
R(R(4, kt, _, z), z, -Q, it),
|
|
307
307
|
it,
|
|
308
308
|
et,
|
|
309
309
|
at
|
|
310
|
-
), at)),
|
|
311
|
-
|
|
310
|
+
), at)), u !== 0 && (p = R(4, Dt, u, Te), f = ct(f, Mt(
|
|
311
|
+
R(p, Te, 2 * Q, K),
|
|
312
312
|
K,
|
|
313
|
-
|
|
313
|
+
R(R(4, At, u, z), z, H, nt),
|
|
314
314
|
nt,
|
|
315
|
-
|
|
315
|
+
R(R(4, kt, u, z), z, -Z, it),
|
|
316
316
|
it,
|
|
317
317
|
et,
|
|
318
318
|
at
|
|
319
|
-
), at)), w !== 0 && (
|
|
320
|
-
|
|
319
|
+
), at)), w !== 0 && (b = R(4, Dt, w, Ce), f = ct(f, Mt(
|
|
320
|
+
R(b, Ce, 2 * W, K),
|
|
321
321
|
K,
|
|
322
|
-
|
|
322
|
+
R(R(4, kt, w, z), z, J, nt),
|
|
323
323
|
nt,
|
|
324
|
-
|
|
324
|
+
R(R(4, At, w, z), z, -G, it),
|
|
325
325
|
it,
|
|
326
326
|
et,
|
|
327
327
|
at
|
|
328
|
-
), at)),
|
|
329
|
-
if (c !== 0 ||
|
|
330
|
-
const rt =
|
|
331
|
-
|
|
332
|
-
|
|
328
|
+
), at)), h !== 0 || d !== 0) {
|
|
329
|
+
if (c !== 0 || _ !== 0 || u !== 0 || w !== 0 ? (Y = c * W, I = q * c, A = I - (I - c), T = c - A, I = q * W, X = I - (I - W), D = W - X, L = T * D - (Y - A * X - T * X - A * D), V = J * w, I = q * J, A = I - (I - J), T = J - A, I = q * w, X = I - (I - w), D = w - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, Y = u * -Z, I = q * u, A = I - (I - u), T = u - A, I = q * -Z, X = I - (I - -Z), D = -Z - X, L = T * D - (Y - A * X - T * X - A * D), V = Q * -_, I = q * Q, A = I - (I - Q), T = Q - A, I = q * -_, X = I - (I - -_), D = -_ - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, E = ht(4, gt, 4, wt, de), Y = c * w, I = q * c, A = I - (I - c), T = c - A, I = q * w, X = I - (I - w), D = w - X, L = T * D - (Y - A * X - T * X - A * D), V = u * _, I = q * u, A = I - (I - u), T = u - A, I = q * _, X = I - (I - _), D = _ - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Vt[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, Vt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Vt[2] = B - (U - y) + (x - y), Vt[3] = U, P = 4) : (de[0] = 0, E = 1, Vt[0] = 0, P = 1), h !== 0) {
|
|
330
|
+
const rt = R(E, de, h, it);
|
|
331
|
+
f = ct(f, ht(
|
|
332
|
+
R(O, Oe, h, K),
|
|
333
333
|
K,
|
|
334
|
-
|
|
334
|
+
R(rt, it, 2 * G, et),
|
|
335
335
|
et,
|
|
336
336
|
at
|
|
337
337
|
), at);
|
|
338
|
-
const ot =
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
const ot = R(P, Vt, h, z);
|
|
339
|
+
f = ct(f, Mt(
|
|
340
|
+
R(ot, z, 2 * G, K),
|
|
341
341
|
K,
|
|
342
|
-
|
|
342
|
+
R(ot, z, h, nt),
|
|
343
343
|
nt,
|
|
344
|
-
|
|
344
|
+
R(rt, it, h, et),
|
|
345
345
|
et,
|
|
346
|
-
|
|
346
|
+
Ft,
|
|
347
347
|
bt
|
|
348
|
-
), bt),
|
|
348
|
+
), bt), _ !== 0 && (f = ct(f, R(R(4, It, h, z), z, _, K), K)), w !== 0 && (f = ct(f, R(R(4, At, -h, z), z, w, K), K));
|
|
349
349
|
}
|
|
350
|
-
if (
|
|
351
|
-
const rt =
|
|
352
|
-
|
|
353
|
-
|
|
350
|
+
if (d !== 0) {
|
|
351
|
+
const rt = R(E, de, d, it);
|
|
352
|
+
f = ct(f, ht(
|
|
353
|
+
R(M, Pe, d, K),
|
|
354
354
|
K,
|
|
355
|
-
|
|
355
|
+
R(rt, it, 2 * H, et),
|
|
356
356
|
et,
|
|
357
357
|
at
|
|
358
358
|
), at);
|
|
359
|
-
const ot =
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
const ot = R(P, Vt, d, z);
|
|
360
|
+
f = ct(f, Mt(
|
|
361
|
+
R(ot, z, 2 * H, K),
|
|
362
362
|
K,
|
|
363
|
-
|
|
363
|
+
R(ot, z, d, nt),
|
|
364
364
|
nt,
|
|
365
|
-
|
|
365
|
+
R(rt, it, d, et),
|
|
366
366
|
et,
|
|
367
|
-
|
|
367
|
+
Ft,
|
|
368
368
|
bt
|
|
369
369
|
), bt);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
if (c !== 0 ||
|
|
373
|
-
if (
|
|
374
|
-
const rt =
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
if (c !== 0 || _ !== 0) {
|
|
373
|
+
if (u !== 0 || w !== 0 || h !== 0 || d !== 0 ? (Y = u * H, I = q * u, A = I - (I - u), T = u - A, I = q * H, X = I - (I - H), D = H - X, L = T * D - (Y - A * X - T * X - A * D), V = Q * d, I = q * Q, A = I - (I - Q), T = Q - A, I = q * d, X = I - (I - d), D = d - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, C = -W, F = -w, Y = h * C, I = q * h, A = I - (I - h), T = h - A, I = q * C, X = I - (I - C), D = C - X, L = T * D - (Y - A * X - T * X - A * D), V = G * F, I = q * G, A = I - (I - G), T = G - A, I = q * F, X = I - (I - F), D = F - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, S = ht(4, gt, 4, wt, pe), Y = u * d, I = q * u, A = I - (I - u), T = u - A, I = q * d, X = I - (I - d), D = d - X, L = T * D - (Y - A * X - T * X - A * D), V = h * w, I = q * h, A = I - (I - h), T = h - A, I = q * w, X = I - (I - w), D = w - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Ut[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, Ut[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Ut[2] = B - (U - y) + (x - y), Ut[3] = U, N = 4) : (pe[0] = 0, S = 1, Ut[0] = 0, N = 1), c !== 0) {
|
|
374
|
+
const rt = R(S, pe, c, it);
|
|
375
|
+
f = ct(f, ht(
|
|
376
|
+
R(m, Ne, c, K),
|
|
377
377
|
K,
|
|
378
|
-
|
|
378
|
+
R(rt, it, 2 * J, et),
|
|
379
379
|
et,
|
|
380
380
|
at
|
|
381
381
|
), at);
|
|
382
|
-
const ot =
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
const ot = R(N, Ut, c, z);
|
|
383
|
+
f = ct(f, Mt(
|
|
384
|
+
R(ot, z, 2 * J, K),
|
|
385
385
|
K,
|
|
386
|
-
|
|
386
|
+
R(ot, z, c, nt),
|
|
387
387
|
nt,
|
|
388
|
-
|
|
388
|
+
R(rt, it, c, et),
|
|
389
389
|
et,
|
|
390
|
-
|
|
390
|
+
Ft,
|
|
391
391
|
bt
|
|
392
|
-
), bt), w !== 0 && (
|
|
392
|
+
), bt), w !== 0 && (f = ct(f, R(R(4, kt, c, z), z, w, K), K)), d !== 0 && (f = ct(f, R(R(4, It, -c, z), z, d, K), K));
|
|
393
393
|
}
|
|
394
|
-
if (
|
|
395
|
-
const rt =
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
if (_ !== 0) {
|
|
395
|
+
const rt = R(S, pe, _, it);
|
|
396
|
+
f = ct(f, ht(
|
|
397
|
+
R(v, Be, _, K),
|
|
398
398
|
K,
|
|
399
|
-
|
|
399
|
+
R(rt, it, 2 * Z, et),
|
|
400
400
|
et,
|
|
401
401
|
at
|
|
402
402
|
), at);
|
|
403
|
-
const ot =
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
const ot = R(N, Ut, _, z);
|
|
404
|
+
f = ct(f, Mt(
|
|
405
|
+
R(ot, z, 2 * Z, K),
|
|
406
406
|
K,
|
|
407
|
-
|
|
407
|
+
R(ot, z, _, nt),
|
|
408
408
|
nt,
|
|
409
|
-
|
|
409
|
+
R(rt, it, _, et),
|
|
410
410
|
et,
|
|
411
|
-
|
|
411
|
+
Ft,
|
|
412
412
|
bt
|
|
413
413
|
), bt);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
if (
|
|
417
|
-
if (
|
|
418
|
-
const rt =
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
if (u !== 0 || w !== 0) {
|
|
417
|
+
if (h !== 0 || d !== 0 || c !== 0 || _ !== 0 ? (Y = h * Z, I = q * h, A = I - (I - h), T = h - A, I = q * Z, X = I - (I - Z), D = Z - X, L = T * D - (Y - A * X - T * X - A * D), V = G * _, I = q * G, A = I - (I - G), T = G - A, I = q * _, X = I - (I - _), D = _ - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, C = -H, F = -d, Y = c * C, I = q * c, A = I - (I - c), T = c - A, I = q * C, X = I - (I - C), D = C - X, L = T * D - (Y - A * X - T * X - A * D), V = J * F, I = q * J, A = I - (I - J), T = J - A, I = q * F, X = I - (I - F), D = F - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, g = ht(4, gt, 4, wt, ue), Y = h * _, I = q * h, A = I - (I - h), T = h - A, I = q * _, X = I - (I - _), D = _ - X, L = T * D - (Y - A * X - T * X - A * D), V = c * d, I = q * c, A = I - (I - c), T = c - A, I = q * d, X = I - (I - d), D = d - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Lt[0] = L - (x + y) + (y - j), B = Y + x, y = B - Y, $ = Y - (B - y) + (x - y), x = $ - V, y = $ - x, Lt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Lt[2] = B - (U - y) + (x - y), Lt[3] = U, k = 4) : (ue[0] = 0, g = 1, Lt[0] = 0, k = 1), u !== 0) {
|
|
418
|
+
const rt = R(g, ue, u, it);
|
|
419
|
+
f = ct(f, ht(
|
|
420
|
+
R(p, Te, u, K),
|
|
421
421
|
K,
|
|
422
|
-
|
|
422
|
+
R(rt, it, 2 * Q, et),
|
|
423
423
|
et,
|
|
424
424
|
at
|
|
425
425
|
), at);
|
|
426
|
-
const ot =
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
const ot = R(k, Lt, u, z);
|
|
427
|
+
f = ct(f, Mt(
|
|
428
|
+
R(ot, z, 2 * Q, K),
|
|
429
429
|
K,
|
|
430
|
-
|
|
430
|
+
R(ot, z, u, nt),
|
|
431
431
|
nt,
|
|
432
|
-
|
|
432
|
+
R(rt, it, u, et),
|
|
433
433
|
et,
|
|
434
|
-
|
|
434
|
+
Ft,
|
|
435
435
|
bt
|
|
436
|
-
), bt),
|
|
436
|
+
), bt), d !== 0 && (f = ct(f, R(R(4, At, u, z), z, d, K), K)), _ !== 0 && (f = ct(f, R(R(4, kt, -u, z), z, _, K), K));
|
|
437
437
|
}
|
|
438
438
|
if (w !== 0) {
|
|
439
|
-
const rt =
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
const rt = R(g, ue, w, it);
|
|
440
|
+
f = ct(f, ht(
|
|
441
|
+
R(b, Ce, w, K),
|
|
442
442
|
K,
|
|
443
|
-
|
|
443
|
+
R(rt, it, 2 * W, et),
|
|
444
444
|
et,
|
|
445
445
|
at
|
|
446
446
|
), at);
|
|
447
|
-
const ot =
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
const ot = R(k, Lt, w, z);
|
|
448
|
+
f = ct(f, Mt(
|
|
449
|
+
R(ot, z, 2 * W, K),
|
|
450
450
|
K,
|
|
451
|
-
|
|
451
|
+
R(ot, z, w, nt),
|
|
452
452
|
nt,
|
|
453
|
-
|
|
453
|
+
R(rt, it, w, et),
|
|
454
454
|
et,
|
|
455
|
-
|
|
455
|
+
Ft,
|
|
456
456
|
bt
|
|
457
457
|
), bt);
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
return Qt[
|
|
460
|
+
return Qt[f - 1];
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const
|
|
464
|
-
return
|
|
462
|
+
function mi(e, t, n, i, o, r, s, a) {
|
|
463
|
+
const l = e - s, f = n - s, h = o - s, c = t - a, u = i - a, d = r - a, _ = f * d, w = h * u, O = l * l + c * c, M = h * c, m = l * d, v = f * f + u * u, p = l * u, b = f * c, g = h * h + d * d, E = O * (_ - w) + v * (M - m) + g * (p - b), S = (Math.abs(_) + Math.abs(w)) * O + (Math.abs(M) + Math.abs(m)) * v + (Math.abs(p) + Math.abs(b)) * g, k = hi * S;
|
|
464
|
+
return E > k || -E > k ? E : pi(e, t, n, i, o, r, s, a, S);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
var n, i, o = 0, r, s, a,
|
|
468
|
-
for (n = 0; n <
|
|
466
|
+
function gi(e, t) {
|
|
467
|
+
var n, i, o = 0, r, s, a, l, f, h, c, u = e[0], d = e[1], _ = t.length;
|
|
468
|
+
for (n = 0; n < _; n++) {
|
|
469
469
|
i = 0;
|
|
470
|
-
var w = t[n],
|
|
471
|
-
if (
|
|
470
|
+
var w = t[n], O = w.length - 1;
|
|
471
|
+
if (h = w[0], h[0] !== w[O][0] && h[1] !== w[O][1])
|
|
472
472
|
throw new Error("First and last coordinates in a ring must be the same");
|
|
473
|
-
for (s =
|
|
474
|
-
if (c = w[i + 1],
|
|
475
|
-
if (
|
|
473
|
+
for (s = h[0] - u, a = h[1] - d, i; i < O; i++) {
|
|
474
|
+
if (c = w[i + 1], l = c[0] - u, f = c[1] - d, a === 0 && f === 0) {
|
|
475
|
+
if (l <= 0 && s >= 0 || s <= 0 && l >= 0)
|
|
476
476
|
return 0;
|
|
477
|
-
} else if (
|
|
478
|
-
if (r =
|
|
477
|
+
} else if (f >= 0 && a <= 0 || f <= 0 && a >= 0) {
|
|
478
|
+
if (r = Ot(s, l, a, f, 0, 0), r === 0)
|
|
479
479
|
return 0;
|
|
480
|
-
(r > 0 &&
|
|
480
|
+
(r > 0 && f > 0 && a <= 0 || r < 0 && f <= 0 && a > 0) && o++;
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
h = c, a = f, s = l;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
return o % 2 !== 0;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function $e(e, t, n = {}) {
|
|
488
488
|
if (!e)
|
|
489
489
|
throw new Error("point is required");
|
|
490
490
|
if (!t)
|
|
491
491
|
throw new Error("polygon is required");
|
|
492
|
-
const i =
|
|
492
|
+
const i = oi(e), o = si(t), r = o.type, s = t.bbox;
|
|
493
493
|
let a = o.coordinates;
|
|
494
|
-
if (s &&
|
|
494
|
+
if (s && wi(i, s) === !1)
|
|
495
495
|
return !1;
|
|
496
496
|
r === "Polygon" && (a = [a]);
|
|
497
|
-
for (var
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
500
|
-
if (
|
|
497
|
+
for (var l = 0; l < a.length; ++l) {
|
|
498
|
+
const f = gi(i, a[l]);
|
|
499
|
+
if (f === 0 && !n.ignoreBoundary) return !0;
|
|
500
|
+
if (f) return !0;
|
|
501
501
|
}
|
|
502
502
|
return !1;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function wi(e, t) {
|
|
505
505
|
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
|
|
506
506
|
}
|
|
507
|
-
class
|
|
508
|
-
constructor(t = [], n =
|
|
507
|
+
class Je {
|
|
508
|
+
constructor(t = [], n = yi) {
|
|
509
509
|
if (this.data = t, this.length = this.data.length, this.compare = n, this.length > 0)
|
|
510
510
|
for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);
|
|
511
511
|
}
|
|
@@ -533,73 +533,73 @@ class Ge {
|
|
|
533
533
|
const { data: n, compare: i } = this, o = this.length >> 1, r = n[t];
|
|
534
534
|
for (; t < o; ) {
|
|
535
535
|
let s = (t << 1) + 1, a = n[s];
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
536
|
+
const l = s + 1;
|
|
537
|
+
if (l < this.length && i(n[l], a) < 0 && (s = l, a = n[l]), i(a, r) >= 0) break;
|
|
538
538
|
n[t] = a, t = s;
|
|
539
539
|
}
|
|
540
540
|
n[t] = r;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function yi(e, t) {
|
|
544
544
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
545
545
|
}
|
|
546
|
-
const
|
|
546
|
+
const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
547
547
|
__proto__: null,
|
|
548
|
-
default:
|
|
549
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
550
|
-
function
|
|
551
|
-
let r, s, a,
|
|
552
|
-
|
|
553
|
-
let
|
|
554
|
-
if (c < e &&
|
|
555
|
-
for (
|
|
556
|
-
|
|
548
|
+
default: Je
|
|
549
|
+
}, Symbol.toStringTag, { value: "Module" })), Bt = 11102230246251565e-32, ut = 134217729, bi = (3 + 8 * Bt) * Bt;
|
|
550
|
+
function De(e, t, n, i, o) {
|
|
551
|
+
let r, s, a, l, f = t[0], h = i[0], c = 0, u = 0;
|
|
552
|
+
h > f == h > -f ? (r = f, f = t[++c]) : (r = h, h = i[++u]);
|
|
553
|
+
let d = 0;
|
|
554
|
+
if (c < e && u < n)
|
|
555
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++c]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[d++] = a); c < e && u < n; )
|
|
556
|
+
h > f == h > -f ? (s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u]), r = s, a !== 0 && (o[d++] = a);
|
|
557
557
|
for (; c < e; )
|
|
558
|
-
s = r +
|
|
559
|
-
for (;
|
|
560
|
-
s = r +
|
|
561
|
-
return (r !== 0 ||
|
|
558
|
+
s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c], r = s, a !== 0 && (o[d++] = a);
|
|
559
|
+
for (; u < n; )
|
|
560
|
+
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u], r = s, a !== 0 && (o[d++] = a);
|
|
561
|
+
return (r !== 0 || d === 0) && (o[d++] = r), d;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function xi(e, t) {
|
|
564
564
|
let n = t[0];
|
|
565
565
|
for (let i = 1; i < e; i++) n += t[i];
|
|
566
566
|
return n;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function fe(e) {
|
|
569
569
|
return new Float64Array(e);
|
|
570
570
|
}
|
|
571
|
-
const
|
|
572
|
-
function
|
|
573
|
-
let a,
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
let
|
|
577
|
-
if (
|
|
578
|
-
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
const T =
|
|
571
|
+
const _i = (3 + 16 * Bt) * Bt, Mi = (2 + 12 * Bt) * Bt, Si = (9 + 64 * Bt) * Bt * Bt, Jt = fe(4), nn = fe(8), rn = fe(12), on = fe(16), yt = fe(4);
|
|
572
|
+
function Ei(e, t, n, i, o, r, s) {
|
|
573
|
+
let a, l, f, h, c, u, d, _, w, O, M, m, v, p, b, g, E, S;
|
|
574
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
575
|
+
p = k * C, u = ut * k, d = u - (u - k), _ = k - d, u = ut * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * P, u = ut * N, d = u - (u - N), _ = N - d, u = ut * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, Jt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, Jt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, Jt[2] = m - (S - c) + (M - c), Jt[3] = S;
|
|
576
|
+
let F = xi(4, Jt), y = Mi * s;
|
|
577
|
+
if (F >= y || -F >= y || (c = e - k, a = e - (k + c) + (c - o), c = n - P, f = n - (P + c) + (c - o), c = t - N, l = t - (N + c) + (c - r), c = i - C, h = i - (C + c) + (c - r), a === 0 && l === 0 && f === 0 && h === 0) || (y = Si * s + bi * Math.abs(F), F += k * h + C * a - (N * f + P * l), F >= y || -F >= y)) return F;
|
|
578
|
+
p = a * C, u = ut * a, d = u - (u - a), _ = a - d, u = ut * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * P, u = ut * l, d = u - (u - l), _ = l - d, u = ut * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, yt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, yt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, yt[2] = m - (S - c) + (M - c), yt[3] = S;
|
|
579
|
+
const I = De(4, Jt, 4, yt, nn);
|
|
580
|
+
p = k * h, u = ut * k, d = u - (u - k), _ = k - d, u = ut * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * f, u = ut * N, d = u - (u - N), _ = N - d, u = ut * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, yt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, yt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, yt[2] = m - (S - c) + (M - c), yt[3] = S;
|
|
581
|
+
const A = De(I, nn, 4, yt, rn);
|
|
582
|
+
p = a * h, u = ut * a, d = u - (u - a), _ = a - d, u = ut * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * f, u = ut * l, d = u - (u - l), _ = l - d, u = ut * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, yt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, yt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, yt[2] = m - (S - c) + (M - c), yt[3] = S;
|
|
583
|
+
const T = De(A, rn, 4, yt, on);
|
|
584
584
|
return on[T - 1];
|
|
585
585
|
}
|
|
586
586
|
function sn(e, t, n, i, o, r) {
|
|
587
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
588
|
-
if (s === 0 || a === 0 || s > 0 != a > 0) return
|
|
589
|
-
const
|
|
590
|
-
return Math.abs(
|
|
587
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), l = s - a;
|
|
588
|
+
if (s === 0 || a === 0 || s > 0 != a > 0) return l;
|
|
589
|
+
const f = Math.abs(s + a);
|
|
590
|
+
return Math.abs(l) >= _i * f ? l : -Ei(e, t, n, i, o, r, f);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
const n = new
|
|
594
|
-
return
|
|
592
|
+
function ki(e, t) {
|
|
593
|
+
const n = new Je([], Un);
|
|
594
|
+
return Ii(e, n), Oi(n, t);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Un(e, t) {
|
|
597
597
|
return e.p.x > t.p.x ? 1 : e.p.x < t.p.x || e.p.x === t.p.x && (e.featureId !== t.featureId || e.ringId !== t.ringId) && e.isLeftEndpoint && !t.isLeftEndpoint ? -1 : e.p.y !== t.p.y ? e.p.y > t.p.y ? 1 : -1 : 1;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Ai(e, t) {
|
|
600
600
|
return e.rightSweepEvent.p.x > t.rightSweepEvent.p.x ? 1 : e.rightSweepEvent.p.x < t.rightSweepEvent.p.x ? -1 : e.rightSweepEvent.p.y !== t.rightSweepEvent.p.y ? e.rightSweepEvent.p.y < t.rightSweepEvent.p.y ? 1 : -1 : 1;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Ii(e, t) {
|
|
603
603
|
if (e.type === "FeatureCollection") {
|
|
604
604
|
const n = e.features;
|
|
605
605
|
for (let i = 0; i < n.length; i++)
|
|
@@ -616,10 +616,10 @@ function an(e, t) {
|
|
|
616
616
|
for (let r = 0; r < i[o].length; r++) {
|
|
617
617
|
let s = i[o][r][0], a = null;
|
|
618
618
|
ge = ge + 1;
|
|
619
|
-
for (let
|
|
620
|
-
a = i[o][r][
|
|
621
|
-
const
|
|
622
|
-
|
|
619
|
+
for (let l = 0; l < i[o][r].length - 1; l++) {
|
|
620
|
+
a = i[o][r][l + 1];
|
|
621
|
+
const f = new cn(s, me, ge, we), h = new cn(a, me, ge, we + 1);
|
|
622
|
+
f.otherEvent = h, h.otherEvent = f, Un(f, h) > 0 ? (h.isLeftEndpoint = !0, f.isLeftEndpoint = !1) : (f.isLeftEndpoint = !0, h.isLeftEndpoint = !1), t.push(f), t.push(h), s = a, we = we + 1;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
me = me + 1;
|
|
@@ -638,35 +638,35 @@ var cn = class {
|
|
|
638
638
|
return [this.p.x, this.p.y];
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
|
-
function
|
|
642
|
-
const n = [], i = new
|
|
641
|
+
function Oi(e, t = !1) {
|
|
642
|
+
const n = [], i = new Je([], Ai);
|
|
643
643
|
for (; e.length; ) {
|
|
644
644
|
const o = e.pop();
|
|
645
645
|
if (o.isLeftEndpoint) {
|
|
646
|
-
const r = new
|
|
646
|
+
const r = new Pi(o);
|
|
647
647
|
for (let s = 0; s < i.data.length; s++) {
|
|
648
648
|
const a = i.data[s];
|
|
649
649
|
if (t && a.leftSweepEvent.featureId === o.featureId)
|
|
650
650
|
continue;
|
|
651
|
-
const
|
|
652
|
-
|
|
651
|
+
const l = Ni(r, a);
|
|
652
|
+
l !== !1 && n.push(l);
|
|
653
653
|
}
|
|
654
654
|
i.push(r);
|
|
655
655
|
} else o.isLeftEndpoint === !1 && i.pop();
|
|
656
656
|
}
|
|
657
657
|
return n;
|
|
658
658
|
}
|
|
659
|
-
var
|
|
659
|
+
var Pi = class {
|
|
660
660
|
/** @param event must have otherEvent non-null */
|
|
661
661
|
constructor(e) {
|
|
662
662
|
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
|
-
function
|
|
665
|
+
function Ni(e, t) {
|
|
666
666
|
if (e === null || t === null) return !1;
|
|
667
|
-
const n = e.leftSweepEvent.p.x, i = e.leftSweepEvent.p.y, o = e.rightSweepEvent.p.x, r = e.rightSweepEvent.p.y, s = t.leftSweepEvent.p.x, a = t.leftSweepEvent.p.y,
|
|
668
|
-
if (
|
|
669
|
-
if (
|
|
667
|
+
const n = e.leftSweepEvent.p.x, i = e.leftSweepEvent.p.y, o = e.rightSweepEvent.p.x, r = e.rightSweepEvent.p.y, s = t.leftSweepEvent.p.x, a = t.leftSweepEvent.p.y, l = t.rightSweepEvent.p.x, f = t.rightSweepEvent.p.y, h = sn(n, i, o, r, s, a), c = sn(n, i, o, r, l, f);
|
|
668
|
+
if (h > 0 && c > 0) return !1;
|
|
669
|
+
if (h < 0 && c < 0) return !1;
|
|
670
670
|
if (e.leftSweepEvent.ringId === t.leftSweepEvent.ringId) {
|
|
671
671
|
if (e.rightSweepEvent.isSamePoint(t.leftSweepEvent) || e.rightSweepEvent.isSamePoint(t.rightSweepEvent) || e.leftSweepEvent.isSamePoint(t.leftSweepEvent) || e.leftSweepEvent.isSamePoint(t.rightSweepEvent))
|
|
672
672
|
return !1;
|
|
@@ -680,39 +680,39 @@ function Ii(e, t) {
|
|
|
680
680
|
if (e.leftSweepEvent.isSamePoint(t.rightSweepEvent))
|
|
681
681
|
return t.rightSweepEvent.asNewXY();
|
|
682
682
|
}
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
683
|
+
const u = (f - a) * (o - n) - (l - s) * (r - i), d = (l - s) * (i - a) - (f - a) * (n - s), _ = (o - n) * (i - a) - (r - i) * (n - s);
|
|
684
|
+
if (u === 0)
|
|
685
685
|
return !1;
|
|
686
|
-
const w =
|
|
687
|
-
if (w >= 0 && w <= 1 &&
|
|
688
|
-
const
|
|
689
|
-
return [
|
|
686
|
+
const w = d / u, O = _ / u;
|
|
687
|
+
if (w >= 0 && w <= 1 && O >= 0 && O <= 1) {
|
|
688
|
+
const M = n + w * (o - n), m = i + w * (r - i);
|
|
689
|
+
return [M, m];
|
|
690
690
|
}
|
|
691
691
|
return !1;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function Bi(e, t, n = {}) {
|
|
694
694
|
const { removeDuplicates: i = !0, ignoreSelfIntersections: o = !0 } = n;
|
|
695
695
|
let r = [];
|
|
696
696
|
e.type === "FeatureCollection" ? r = r.concat(e.features) : e.type === "Feature" ? r.push(e) : (e.type === "LineString" || e.type === "Polygon" || e.type === "MultiLineString" || e.type === "MultiPolygon") && r.push(oe(e)), t.type === "FeatureCollection" ? r = r.concat(t.features) : t.type === "Feature" ? r.push(t) : (t.type === "LineString" || t.type === "Polygon" || t.type === "MultiLineString" || t.type === "MultiPolygon") && r.push(oe(t));
|
|
697
|
-
const s =
|
|
698
|
-
|
|
697
|
+
const s = ki(
|
|
698
|
+
Et(r),
|
|
699
699
|
o
|
|
700
700
|
);
|
|
701
701
|
let a = [];
|
|
702
702
|
if (i) {
|
|
703
|
-
const
|
|
704
|
-
s.forEach((
|
|
705
|
-
const
|
|
706
|
-
h
|
|
703
|
+
const l = {};
|
|
704
|
+
s.forEach((f) => {
|
|
705
|
+
const h = f.join(",");
|
|
706
|
+
l[h] || (l[h] = !0, a.push(f));
|
|
707
707
|
});
|
|
708
708
|
} else
|
|
709
709
|
a = s;
|
|
710
|
-
return
|
|
710
|
+
return Et(a.map((l) => Rt(l)));
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Ti(e) {
|
|
713
713
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Ci(e) {
|
|
716
716
|
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
717
717
|
var t = e.default;
|
|
718
718
|
if (typeof t == "function") {
|
|
@@ -736,7 +736,7 @@ function Bi(e) {
|
|
|
736
736
|
});
|
|
737
737
|
}), n;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Xi(e, t = {}) {
|
|
740
740
|
let n = 0, i = 0, o = 0;
|
|
741
741
|
return ze(
|
|
742
742
|
e,
|
|
@@ -744,406 +744,406 @@ function Ni(e, t = {}) {
|
|
|
744
744
|
n += r[0], i += r[1], o++;
|
|
745
745
|
},
|
|
746
746
|
!0
|
|
747
|
-
),
|
|
747
|
+
), Rt([n / o, i / o], t.properties);
|
|
748
748
|
}
|
|
749
|
-
var ye = { exports: {} },
|
|
750
|
-
function
|
|
749
|
+
var ye = { exports: {} }, ke = { exports: {} }, $i = ke.exports, ln;
|
|
750
|
+
function Di() {
|
|
751
751
|
return ln || (ln = 1, (function(e, t) {
|
|
752
752
|
(function(n, i) {
|
|
753
753
|
e.exports = i();
|
|
754
|
-
})(
|
|
755
|
-
function n(m,
|
|
756
|
-
(function
|
|
757
|
-
for (;
|
|
758
|
-
if (
|
|
759
|
-
var
|
|
760
|
-
|
|
754
|
+
})($i, function() {
|
|
755
|
+
function n(m, v, p, b, g) {
|
|
756
|
+
(function E(S, k, P, N, C) {
|
|
757
|
+
for (; N > P; ) {
|
|
758
|
+
if (N - P > 600) {
|
|
759
|
+
var F = N - P + 1, y = k - P + 1, I = Math.log(F), A = 0.5 * Math.exp(2 * I / 3), T = 0.5 * Math.sqrt(I * A * (F - A) / F) * (y - F / 2 < 0 ? -1 : 1), X = Math.max(P, Math.floor(k - y * A / F + T)), D = Math.min(N, Math.floor(k + (F - y) * A / F + T));
|
|
760
|
+
E(S, k, X, D, C);
|
|
761
761
|
}
|
|
762
|
-
var
|
|
763
|
-
for (i(S,
|
|
764
|
-
for (i(S,
|
|
765
|
-
for (;
|
|
762
|
+
var x = S[k], B = P, $ = N;
|
|
763
|
+
for (i(S, P, k), C(S[N], x) > 0 && i(S, P, N); B < $; ) {
|
|
764
|
+
for (i(S, B, $), B++, $--; C(S[B], x) < 0; ) B++;
|
|
765
|
+
for (; C(S[$], x) > 0; ) $--;
|
|
766
766
|
}
|
|
767
|
-
|
|
767
|
+
C(S[P], x) === 0 ? i(S, P, $) : i(S, ++$, N), $ <= k && (P = $ + 1), k <= $ && (N = $ - 1);
|
|
768
768
|
}
|
|
769
|
-
})(m,
|
|
769
|
+
})(m, v, p || 0, b || m.length - 1, g || o);
|
|
770
770
|
}
|
|
771
|
-
function i(m,
|
|
772
|
-
var
|
|
773
|
-
m[
|
|
771
|
+
function i(m, v, p) {
|
|
772
|
+
var b = m[v];
|
|
773
|
+
m[v] = m[p], m[p] = b;
|
|
774
774
|
}
|
|
775
|
-
function o(m,
|
|
776
|
-
return m <
|
|
775
|
+
function o(m, v) {
|
|
776
|
+
return m < v ? -1 : m > v ? 1 : 0;
|
|
777
777
|
}
|
|
778
778
|
var r = function(m) {
|
|
779
779
|
m === void 0 && (m = 9), this._maxEntries = Math.max(4, m), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
780
780
|
};
|
|
781
|
-
function s(m,
|
|
782
|
-
if (!
|
|
783
|
-
for (var
|
|
781
|
+
function s(m, v, p) {
|
|
782
|
+
if (!p) return v.indexOf(m);
|
|
783
|
+
for (var b = 0; b < v.length; b++) if (p(m, v[b])) return b;
|
|
784
784
|
return -1;
|
|
785
785
|
}
|
|
786
|
-
function a(m,
|
|
787
|
-
|
|
786
|
+
function a(m, v) {
|
|
787
|
+
l(m, 0, m.children.length, v, m);
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
g || (g =
|
|
791
|
-
for (var
|
|
792
|
-
var S = m.children[
|
|
793
|
-
|
|
789
|
+
function l(m, v, p, b, g) {
|
|
790
|
+
g || (g = O(null)), g.minX = 1 / 0, g.minY = 1 / 0, g.maxX = -1 / 0, g.maxY = -1 / 0;
|
|
791
|
+
for (var E = v; E < p; E++) {
|
|
792
|
+
var S = m.children[E];
|
|
793
|
+
f(g, m.leaf ? b(S) : S);
|
|
794
794
|
}
|
|
795
795
|
return g;
|
|
796
796
|
}
|
|
797
|
-
function
|
|
798
|
-
return m.minX = Math.min(m.minX,
|
|
797
|
+
function f(m, v) {
|
|
798
|
+
return m.minX = Math.min(m.minX, v.minX), m.minY = Math.min(m.minY, v.minY), m.maxX = Math.max(m.maxX, v.maxX), m.maxY = Math.max(m.maxY, v.maxY), m;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
801
|
-
return m.minX -
|
|
800
|
+
function h(m, v) {
|
|
801
|
+
return m.minX - v.minX;
|
|
802
802
|
}
|
|
803
|
-
function c(m,
|
|
804
|
-
return m.minY -
|
|
803
|
+
function c(m, v) {
|
|
804
|
+
return m.minY - v.minY;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function u(m) {
|
|
807
807
|
return (m.maxX - m.minX) * (m.maxY - m.minY);
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function d(m) {
|
|
810
810
|
return m.maxX - m.minX + (m.maxY - m.minY);
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
return m.minX <=
|
|
812
|
+
function _(m, v) {
|
|
813
|
+
return m.minX <= v.minX && m.minY <= v.minY && v.maxX <= m.maxX && v.maxY <= m.maxY;
|
|
814
814
|
}
|
|
815
|
-
function w(m,
|
|
816
|
-
return
|
|
815
|
+
function w(m, v) {
|
|
816
|
+
return v.minX <= m.maxX && v.minY <= m.maxY && v.maxX >= m.minX && v.maxY >= m.minY;
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function O(m) {
|
|
819
819
|
return { children: m, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
for (var
|
|
823
|
-
var S =
|
|
824
|
-
n(m, S,
|
|
821
|
+
function M(m, v, p, b, g) {
|
|
822
|
+
for (var E = [v, p]; E.length; ) if (!((p = E.pop()) - (v = E.pop()) <= b)) {
|
|
823
|
+
var S = v + Math.ceil((p - v) / b / 2) * b;
|
|
824
|
+
n(m, S, v, p, g), E.push(v, S, S, p);
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
return r.prototype.all = function() {
|
|
828
828
|
return this._all(this.data, []);
|
|
829
829
|
}, r.prototype.search = function(m) {
|
|
830
|
-
var
|
|
831
|
-
if (!w(m,
|
|
832
|
-
for (var
|
|
833
|
-
for (var
|
|
834
|
-
var S =
|
|
835
|
-
w(m,
|
|
830
|
+
var v = this.data, p = [];
|
|
831
|
+
if (!w(m, v)) return p;
|
|
832
|
+
for (var b = this.toBBox, g = []; v; ) {
|
|
833
|
+
for (var E = 0; E < v.children.length; E++) {
|
|
834
|
+
var S = v.children[E], k = v.leaf ? b(S) : S;
|
|
835
|
+
w(m, k) && (v.leaf ? p.push(S) : _(m, k) ? this._all(S, p) : g.push(S));
|
|
836
836
|
}
|
|
837
|
-
|
|
837
|
+
v = g.pop();
|
|
838
838
|
}
|
|
839
|
-
return
|
|
839
|
+
return p;
|
|
840
840
|
}, r.prototype.collides = function(m) {
|
|
841
|
-
var
|
|
842
|
-
if (!w(m,
|
|
843
|
-
for (var
|
|
844
|
-
for (var
|
|
845
|
-
var g =
|
|
846
|
-
if (w(m,
|
|
847
|
-
if (
|
|
848
|
-
|
|
841
|
+
var v = this.data;
|
|
842
|
+
if (!w(m, v)) return !1;
|
|
843
|
+
for (var p = []; v; ) {
|
|
844
|
+
for (var b = 0; b < v.children.length; b++) {
|
|
845
|
+
var g = v.children[b], E = v.leaf ? this.toBBox(g) : g;
|
|
846
|
+
if (w(m, E)) {
|
|
847
|
+
if (v.leaf || _(m, E)) return !0;
|
|
848
|
+
p.push(g);
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
|
|
851
|
+
v = p.pop();
|
|
852
852
|
}
|
|
853
853
|
return !1;
|
|
854
854
|
}, r.prototype.load = function(m) {
|
|
855
855
|
if (!m || !m.length) return this;
|
|
856
856
|
if (m.length < this._minEntries) {
|
|
857
|
-
for (var
|
|
857
|
+
for (var v = 0; v < m.length; v++) this.insert(m[v]);
|
|
858
858
|
return this;
|
|
859
859
|
}
|
|
860
|
-
var
|
|
861
|
-
if (this.data.children.length) if (this.data.height ===
|
|
860
|
+
var p = this._build(m.slice(), 0, m.length - 1, 0);
|
|
861
|
+
if (this.data.children.length) if (this.data.height === p.height) this._splitRoot(this.data, p);
|
|
862
862
|
else {
|
|
863
|
-
if (this.data.height <
|
|
864
|
-
var
|
|
865
|
-
this.data =
|
|
863
|
+
if (this.data.height < p.height) {
|
|
864
|
+
var b = this.data;
|
|
865
|
+
this.data = p, p = b;
|
|
866
866
|
}
|
|
867
|
-
this._insert(
|
|
867
|
+
this._insert(p, this.data.height - p.height - 1, !0);
|
|
868
868
|
}
|
|
869
|
-
else this.data =
|
|
869
|
+
else this.data = p;
|
|
870
870
|
return this;
|
|
871
871
|
}, r.prototype.insert = function(m) {
|
|
872
872
|
return m && this._insert(m, this.data.height - 1), this;
|
|
873
873
|
}, r.prototype.clear = function() {
|
|
874
|
-
return this.data =
|
|
875
|
-
}, r.prototype.remove = function(m,
|
|
874
|
+
return this.data = O([]), this;
|
|
875
|
+
}, r.prototype.remove = function(m, v) {
|
|
876
876
|
if (!m) return this;
|
|
877
|
-
for (var
|
|
878
|
-
if (
|
|
879
|
-
var
|
|
880
|
-
if (
|
|
877
|
+
for (var p, b, g, E = this.data, S = this.toBBox(m), k = [], P = []; E || k.length; ) {
|
|
878
|
+
if (E || (E = k.pop(), b = k[k.length - 1], p = P.pop(), g = !0), E.leaf) {
|
|
879
|
+
var N = s(m, E.children, v);
|
|
880
|
+
if (N !== -1) return E.children.splice(N, 1), k.push(E), this._condense(k), this;
|
|
881
881
|
}
|
|
882
|
-
g ||
|
|
882
|
+
g || E.leaf || !_(E, S) ? b ? (p++, E = b.children[p], g = !1) : E = null : (k.push(E), P.push(p), p = 0, b = E, E = E.children[0]);
|
|
883
883
|
}
|
|
884
884
|
return this;
|
|
885
885
|
}, r.prototype.toBBox = function(m) {
|
|
886
886
|
return m;
|
|
887
|
-
}, r.prototype.compareMinX = function(m,
|
|
888
|
-
return m.minX -
|
|
889
|
-
}, r.prototype.compareMinY = function(m,
|
|
890
|
-
return m.minY -
|
|
887
|
+
}, r.prototype.compareMinX = function(m, v) {
|
|
888
|
+
return m.minX - v.minX;
|
|
889
|
+
}, r.prototype.compareMinY = function(m, v) {
|
|
890
|
+
return m.minY - v.minY;
|
|
891
891
|
}, r.prototype.toJSON = function() {
|
|
892
892
|
return this.data;
|
|
893
893
|
}, r.prototype.fromJSON = function(m) {
|
|
894
894
|
return this.data = m, this;
|
|
895
|
-
}, r.prototype._all = function(m,
|
|
896
|
-
for (var
|
|
897
|
-
return
|
|
898
|
-
}, r.prototype._build = function(m,
|
|
899
|
-
var g,
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
var
|
|
903
|
-
|
|
904
|
-
for (var
|
|
905
|
-
var
|
|
906
|
-
|
|
907
|
-
for (var
|
|
908
|
-
var y = Math.min(
|
|
909
|
-
g.children.push(this._build(m,
|
|
895
|
+
}, r.prototype._all = function(m, v) {
|
|
896
|
+
for (var p = []; m; ) m.leaf ? v.push.apply(v, m.children) : p.push.apply(p, m.children), m = p.pop();
|
|
897
|
+
return v;
|
|
898
|
+
}, r.prototype._build = function(m, v, p, b) {
|
|
899
|
+
var g, E = p - v + 1, S = this._maxEntries;
|
|
900
|
+
if (E <= S) return a(g = O(m.slice(v, p + 1)), this.toBBox), g;
|
|
901
|
+
b || (b = Math.ceil(Math.log(E) / Math.log(S)), S = Math.ceil(E / Math.pow(S, b - 1))), (g = O([])).leaf = !1, g.height = b;
|
|
902
|
+
var k = Math.ceil(E / S), P = k * Math.ceil(Math.sqrt(S));
|
|
903
|
+
M(m, v, p, P, this.compareMinX);
|
|
904
|
+
for (var N = v; N <= p; N += P) {
|
|
905
|
+
var C = Math.min(N + P - 1, p);
|
|
906
|
+
M(m, N, C, k, this.compareMinY);
|
|
907
|
+
for (var F = N; F <= C; F += k) {
|
|
908
|
+
var y = Math.min(F + k - 1, C);
|
|
909
|
+
g.children.push(this._build(m, F, y, b - 1));
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
return a(g, this.toBBox), g;
|
|
913
|
-
}, r.prototype._chooseSubtree = function(m,
|
|
914
|
-
for (;
|
|
915
|
-
for (var g = 1 / 0,
|
|
916
|
-
var
|
|
917
|
-
|
|
913
|
+
}, r.prototype._chooseSubtree = function(m, v, p, b) {
|
|
914
|
+
for (; b.push(v), !v.leaf && b.length - 1 !== p; ) {
|
|
915
|
+
for (var g = 1 / 0, E = 1 / 0, S = void 0, k = 0; k < v.children.length; k++) {
|
|
916
|
+
var P = v.children[k], N = u(P), C = (F = m, y = P, (Math.max(y.maxX, F.maxX) - Math.min(y.minX, F.minX)) * (Math.max(y.maxY, F.maxY) - Math.min(y.minY, F.minY)) - N);
|
|
917
|
+
C < E ? (E = C, g = N < g ? N : g, S = P) : C === E && N < g && (g = N, S = P);
|
|
918
918
|
}
|
|
919
|
-
|
|
919
|
+
v = S || v.children[0];
|
|
920
920
|
}
|
|
921
|
-
var
|
|
922
|
-
return
|
|
923
|
-
}, r.prototype._insert = function(m,
|
|
924
|
-
var
|
|
925
|
-
for (
|
|
926
|
-
this._adjustParentBBoxes(
|
|
927
|
-
}, r.prototype._split = function(m,
|
|
928
|
-
var
|
|
929
|
-
this._chooseSplitAxis(
|
|
930
|
-
var
|
|
931
|
-
S.height =
|
|
932
|
-
}, r.prototype._splitRoot = function(m,
|
|
933
|
-
this.data =
|
|
934
|
-
}, r.prototype._chooseSplitIndex = function(m,
|
|
935
|
-
for (var
|
|
936
|
-
var
|
|
937
|
-
T <
|
|
921
|
+
var F, y;
|
|
922
|
+
return v;
|
|
923
|
+
}, r.prototype._insert = function(m, v, p) {
|
|
924
|
+
var b = p ? m : this.toBBox(m), g = [], E = this._chooseSubtree(b, this.data, v, g);
|
|
925
|
+
for (E.children.push(m), f(E, b); v >= 0 && g[v].children.length > this._maxEntries; ) this._split(g, v), v--;
|
|
926
|
+
this._adjustParentBBoxes(b, g, v);
|
|
927
|
+
}, r.prototype._split = function(m, v) {
|
|
928
|
+
var p = m[v], b = p.children.length, g = this._minEntries;
|
|
929
|
+
this._chooseSplitAxis(p, g, b);
|
|
930
|
+
var E = this._chooseSplitIndex(p, g, b), S = O(p.children.splice(E, p.children.length - E));
|
|
931
|
+
S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox), v ? m[v - 1].children.push(S) : this._splitRoot(p, S);
|
|
932
|
+
}, r.prototype._splitRoot = function(m, v) {
|
|
933
|
+
this.data = O([m, v]), this.data.height = m.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
|
|
934
|
+
}, r.prototype._chooseSplitIndex = function(m, v, p) {
|
|
935
|
+
for (var b, g, E, S, k, P, N, C = 1 / 0, F = 1 / 0, y = v; y <= p - v; y++) {
|
|
936
|
+
var I = l(m, 0, y, this.toBBox), A = l(m, y, p, this.toBBox), T = (g = I, E = A, S = void 0, k = void 0, P = void 0, N = void 0, S = Math.max(g.minX, E.minX), k = Math.max(g.minY, E.minY), P = Math.min(g.maxX, E.maxX), N = Math.min(g.maxY, E.maxY), Math.max(0, P - S) * Math.max(0, N - k)), X = u(I) + u(A);
|
|
937
|
+
T < C ? (C = T, b = y, F = X < F ? X : F) : T === C && X < F && (F = X, b = y);
|
|
938
938
|
}
|
|
939
|
-
return
|
|
940
|
-
}, r.prototype._chooseSplitAxis = function(m,
|
|
941
|
-
var
|
|
942
|
-
this._allDistMargin(m,
|
|
943
|
-
}, r.prototype._allDistMargin = function(m,
|
|
944
|
-
m.children.sort(
|
|
945
|
-
for (var g = this.toBBox,
|
|
946
|
-
var
|
|
947
|
-
|
|
939
|
+
return b || p - v;
|
|
940
|
+
}, r.prototype._chooseSplitAxis = function(m, v, p) {
|
|
941
|
+
var b = m.leaf ? this.compareMinX : h, g = m.leaf ? this.compareMinY : c;
|
|
942
|
+
this._allDistMargin(m, v, p, b) < this._allDistMargin(m, v, p, g) && m.children.sort(b);
|
|
943
|
+
}, r.prototype._allDistMargin = function(m, v, p, b) {
|
|
944
|
+
m.children.sort(b);
|
|
945
|
+
for (var g = this.toBBox, E = l(m, 0, v, g), S = l(m, p - v, p, g), k = d(E) + d(S), P = v; P < p - v; P++) {
|
|
946
|
+
var N = m.children[P];
|
|
947
|
+
f(E, m.leaf ? g(N) : N), k += d(E);
|
|
948
948
|
}
|
|
949
|
-
for (var
|
|
950
|
-
var
|
|
951
|
-
|
|
949
|
+
for (var C = p - v - 1; C >= v; C--) {
|
|
950
|
+
var F = m.children[C];
|
|
951
|
+
f(S, m.leaf ? g(F) : F), k += d(S);
|
|
952
952
|
}
|
|
953
|
-
return
|
|
954
|
-
}, r.prototype._adjustParentBBoxes = function(m,
|
|
955
|
-
for (var
|
|
953
|
+
return k;
|
|
954
|
+
}, r.prototype._adjustParentBBoxes = function(m, v, p) {
|
|
955
|
+
for (var b = p; b >= 0; b--) f(v[b], m);
|
|
956
956
|
}, r.prototype._condense = function(m) {
|
|
957
|
-
for (var
|
|
957
|
+
for (var v = m.length - 1, p = void 0; v >= 0; v--) m[v].children.length === 0 ? v > 0 ? (p = m[v - 1].children).splice(p.indexOf(m[v]), 1) : this.clear() : a(m[v], this.toBBox);
|
|
958
958
|
}, r;
|
|
959
959
|
});
|
|
960
|
-
})(
|
|
960
|
+
})(ke)), ke.exports;
|
|
961
961
|
}
|
|
962
|
-
const
|
|
963
|
-
var Zt = { exports: {} },
|
|
964
|
-
function
|
|
965
|
-
return
|
|
962
|
+
const Fi = /* @__PURE__ */ Ci(vi);
|
|
963
|
+
var Zt = { exports: {} }, Fe, fn;
|
|
964
|
+
function Yi() {
|
|
965
|
+
return fn || (fn = 1, Fe = function(t, n, i, o) {
|
|
966
966
|
var r = t[0], s = t[1], a = !1;
|
|
967
967
|
i === void 0 && (i = 0), o === void 0 && (o = n.length);
|
|
968
|
-
for (var
|
|
969
|
-
var c = n[i +
|
|
968
|
+
for (var l = (o - i) / 2, f = 0, h = l - 1; f < l; h = f++) {
|
|
969
|
+
var c = n[i + f * 2 + 0], u = n[i + f * 2 + 1], d = n[i + h * 2 + 0], _ = n[i + h * 2 + 1], w = u > s != _ > s && r < (d - c) * (s - u) / (_ - u) + c;
|
|
970
970
|
w && (a = !a);
|
|
971
971
|
}
|
|
972
972
|
return a;
|
|
973
|
-
}),
|
|
973
|
+
}), Fe;
|
|
974
974
|
}
|
|
975
|
-
var
|
|
976
|
-
function
|
|
977
|
-
return
|
|
975
|
+
var Ye, hn;
|
|
976
|
+
function Ri() {
|
|
977
|
+
return hn || (hn = 1, Ye = function(t, n, i, o) {
|
|
978
978
|
var r = t[0], s = t[1], a = !1;
|
|
979
979
|
i === void 0 && (i = 0), o === void 0 && (o = n.length);
|
|
980
|
-
for (var
|
|
981
|
-
var c = n[
|
|
980
|
+
for (var l = o - i, f = 0, h = l - 1; f < l; h = f++) {
|
|
981
|
+
var c = n[f + i][0], u = n[f + i][1], d = n[h + i][0], _ = n[h + i][1], w = u > s != _ > s && r < (d - c) * (s - u) / (_ - u) + c;
|
|
982
982
|
w && (a = !a);
|
|
983
983
|
}
|
|
984
984
|
return a;
|
|
985
|
-
}),
|
|
985
|
+
}), Ye;
|
|
986
986
|
}
|
|
987
987
|
var un;
|
|
988
|
-
function
|
|
988
|
+
function Li() {
|
|
989
989
|
if (un) return Zt.exports;
|
|
990
990
|
un = 1;
|
|
991
|
-
var e =
|
|
991
|
+
var e = Yi(), t = Ri();
|
|
992
992
|
return Zt.exports = function(i, o, r, s) {
|
|
993
993
|
return o.length > 0 && Array.isArray(o[0]) ? t(i, o, r, s) : e(i, o, r, s);
|
|
994
994
|
}, Zt.exports.nested = t, Zt.exports.flat = e, Zt.exports;
|
|
995
995
|
}
|
|
996
|
-
var ee = { exports: {} },
|
|
997
|
-
function
|
|
996
|
+
var ee = { exports: {} }, Vi = ee.exports, dn;
|
|
997
|
+
function Ui() {
|
|
998
998
|
return dn || (dn = 1, (function(e, t) {
|
|
999
999
|
(function(n, i) {
|
|
1000
1000
|
i(t);
|
|
1001
|
-
})(
|
|
1001
|
+
})(Vi, function(n) {
|
|
1002
1002
|
const o = 33306690738754706e-32;
|
|
1003
|
-
function r(w,
|
|
1004
|
-
let
|
|
1005
|
-
|
|
1006
|
-
let
|
|
1007
|
-
if (
|
|
1008
|
-
for (;
|
|
1009
|
-
for (;
|
|
1010
|
-
return
|
|
1003
|
+
function r(w, O, M, m, v) {
|
|
1004
|
+
let p, b, g, E, S = O[0], k = m[0], P = 0, N = 0;
|
|
1005
|
+
k > S == k > -S ? (p = S, S = O[++P]) : (p = k, k = m[++N]);
|
|
1006
|
+
let C = 0;
|
|
1007
|
+
if (P < w && N < M) for (k > S == k > -S ? (g = p - ((b = S + p) - S), S = O[++P]) : (g = p - ((b = k + p) - k), k = m[++N]), p = b, g !== 0 && (v[C++] = g); P < w && N < M; ) k > S == k > -S ? (g = p - ((b = p + S) - (E = b - p)) + (S - E), S = O[++P]) : (g = p - ((b = p + k) - (E = b - p)) + (k - E), k = m[++N]), p = b, g !== 0 && (v[C++] = g);
|
|
1008
|
+
for (; P < w; ) g = p - ((b = p + S) - (E = b - p)) + (S - E), S = O[++P], p = b, g !== 0 && (v[C++] = g);
|
|
1009
|
+
for (; N < M; ) g = p - ((b = p + k) - (E = b - p)) + (k - E), k = m[++N], p = b, g !== 0 && (v[C++] = g);
|
|
1010
|
+
return p === 0 && C !== 0 || (v[C++] = p), C;
|
|
1011
1011
|
}
|
|
1012
1012
|
function s(w) {
|
|
1013
1013
|
return new Float64Array(w);
|
|
1014
1014
|
}
|
|
1015
|
-
const a = 33306690738754716e-32,
|
|
1016
|
-
n.orient2d = function(w,
|
|
1017
|
-
const
|
|
1018
|
-
if (
|
|
1019
|
-
const S = Math.abs(
|
|
1020
|
-
return Math.abs(
|
|
1021
|
-
let
|
|
1022
|
-
const st =
|
|
1023
|
-
|
|
1024
|
-
let
|
|
1015
|
+
const a = 33306690738754716e-32, l = 22204460492503146e-32, f = 11093356479670487e-47, h = s(4), c = s(8), u = s(12), d = s(16), _ = s(4);
|
|
1016
|
+
n.orient2d = function(w, O, M, m, v, p) {
|
|
1017
|
+
const b = (O - p) * (M - v), g = (w - v) * (m - p), E = b - g;
|
|
1018
|
+
if (b === 0 || g === 0 || b > 0 != g > 0) return E;
|
|
1019
|
+
const S = Math.abs(b + g);
|
|
1020
|
+
return Math.abs(E) >= a * S ? E : -(function(k, P, N, C, F, y, I) {
|
|
1021
|
+
let A, T, X, D, x, B, $, Y, L, V, j, U, G, J, Q, H, Z, W;
|
|
1022
|
+
const st = k - F, ft = N - F, rt = P - y, ot = C - y;
|
|
1023
|
+
x = (Q = (Y = st - ($ = (B = 134217729 * st) - (B - st))) * (V = ot - (L = (B = 134217729 * ot) - (B - ot))) - ((J = st * ot) - $ * L - Y * L - $ * V)) - (j = Q - (Z = (Y = rt - ($ = (B = 134217729 * rt) - (B - rt))) * (V = ft - (L = (B = 134217729 * ft) - (B - ft))) - ((H = rt * ft) - $ * L - Y * L - $ * V))), h[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), h[1] = G - (j + x) + (x - H), x = (W = U + j) - U, h[2] = U - (W - x) + (j - x), h[3] = W;
|
|
1024
|
+
let Ct = (function(ri, Ke) {
|
|
1025
1025
|
let Qe = Ke[0];
|
|
1026
|
-
for (let Ie = 1; Ie <
|
|
1026
|
+
for (let Ie = 1; Ie < ri; Ie++) Qe += Ke[Ie];
|
|
1027
1027
|
return Qe;
|
|
1028
|
-
})(4,
|
|
1029
|
-
if (
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
return
|
|
1037
|
-
})(w,
|
|
1038
|
-
}, n.orient2dfast = function(w,
|
|
1039
|
-
return (
|
|
1028
|
+
})(4, h), Wt = l * I;
|
|
1029
|
+
if (Ct >= Wt || -Ct >= Wt || (A = k - (st + (x = k - st)) + (x - F), X = N - (ft + (x = N - ft)) + (x - F), T = P - (rt + (x = P - rt)) + (x - y), D = C - (ot + (x = C - ot)) + (x - y), A === 0 && T === 0 && X === 0 && D === 0) || (Wt = f * I + o * Math.abs(Ct), (Ct += st * D + ot * A - (rt * X + ft * T)) >= Wt || -Ct >= Wt)) return Ct;
|
|
1030
|
+
x = (Q = (Y = A - ($ = (B = 134217729 * A) - (B - A))) * (V = ot - (L = (B = 134217729 * ot) - (B - ot))) - ((J = A * ot) - $ * L - Y * L - $ * V)) - (j = Q - (Z = (Y = T - ($ = (B = 134217729 * T) - (B - T))) * (V = ft - (L = (B = 134217729 * ft) - (B - ft))) - ((H = T * ft) - $ * L - Y * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1031
|
+
const ei = r(4, h, 4, _, c);
|
|
1032
|
+
x = (Q = (Y = st - ($ = (B = 134217729 * st) - (B - st))) * (V = D - (L = (B = 134217729 * D) - (B - D))) - ((J = st * D) - $ * L - Y * L - $ * V)) - (j = Q - (Z = (Y = rt - ($ = (B = 134217729 * rt) - (B - rt))) * (V = X - (L = (B = 134217729 * X) - (B - X))) - ((H = rt * X) - $ * L - Y * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1033
|
+
const ni = r(ei, c, 4, _, u);
|
|
1034
|
+
x = (Q = (Y = A - ($ = (B = 134217729 * A) - (B - A))) * (V = D - (L = (B = 134217729 * D) - (B - D))) - ((J = A * D) - $ * L - Y * L - $ * V)) - (j = Q - (Z = (Y = T - ($ = (B = 134217729 * T) - (B - T))) * (V = X - (L = (B = 134217729 * X) - (B - X))) - ((H = T * X) - $ * L - Y * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1035
|
+
const ii = r(ni, u, 4, _, d);
|
|
1036
|
+
return d[ii - 1];
|
|
1037
|
+
})(w, O, M, m, v, p, S);
|
|
1038
|
+
}, n.orient2dfast = function(w, O, M, m, v, p) {
|
|
1039
|
+
return (O - p) * (M - v) - (w - v) * (m - p);
|
|
1040
1040
|
}, Object.defineProperty(n, "__esModule", { value: !0 });
|
|
1041
1041
|
});
|
|
1042
1042
|
})(ee, ee.exports)), ee.exports;
|
|
1043
1043
|
}
|
|
1044
1044
|
var pn;
|
|
1045
|
-
function
|
|
1045
|
+
function ji() {
|
|
1046
1046
|
if (pn) return ye.exports;
|
|
1047
1047
|
pn = 1;
|
|
1048
|
-
var e =
|
|
1048
|
+
var e = Di(), t = Fi, n = Li(), i = Ui().orient2d;
|
|
1049
1049
|
t.default && (t = t.default), ye.exports = o, ye.exports.default = o;
|
|
1050
|
-
function o(
|
|
1051
|
-
|
|
1052
|
-
var
|
|
1053
|
-
S.toBBox = function(
|
|
1050
|
+
function o(p, b, g) {
|
|
1051
|
+
b = Math.max(0, b === void 0 ? 2 : b), g = g || 0;
|
|
1052
|
+
var E = d(p), S = new e(16);
|
|
1053
|
+
S.toBBox = function($) {
|
|
1054
1054
|
return {
|
|
1055
|
-
minX:
|
|
1056
|
-
minY:
|
|
1057
|
-
maxX:
|
|
1058
|
-
maxY:
|
|
1055
|
+
minX: $[0],
|
|
1056
|
+
minY: $[1],
|
|
1057
|
+
maxX: $[0],
|
|
1058
|
+
maxY: $[1]
|
|
1059
1059
|
};
|
|
1060
|
-
}, S.compareMinX = function(
|
|
1061
|
-
return
|
|
1062
|
-
}, S.compareMinY = function(
|
|
1063
|
-
return
|
|
1064
|
-
}, S.load(
|
|
1065
|
-
for (var
|
|
1066
|
-
var
|
|
1067
|
-
S.remove(
|
|
1060
|
+
}, S.compareMinX = function($, Y) {
|
|
1061
|
+
return $[0] - Y[0];
|
|
1062
|
+
}, S.compareMinY = function($, Y) {
|
|
1063
|
+
return $[1] - Y[1];
|
|
1064
|
+
}, S.load(p);
|
|
1065
|
+
for (var k = [], P = 0, N; P < E.length; P++) {
|
|
1066
|
+
var C = E[P];
|
|
1067
|
+
S.remove(C), N = _(C, N), k.push(N);
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
for (
|
|
1071
|
-
for (var y =
|
|
1072
|
-
var
|
|
1073
|
-
if (!(
|
|
1074
|
-
var
|
|
1075
|
-
|
|
1069
|
+
var F = new e(16);
|
|
1070
|
+
for (P = 0; P < k.length; P++) F.insert(u(k[P]));
|
|
1071
|
+
for (var y = b * b, I = g * g; k.length; ) {
|
|
1072
|
+
var A = k.shift(), T = A.p, X = A.next.p, D = w(T, X);
|
|
1073
|
+
if (!(D < I)) {
|
|
1074
|
+
var x = D / y;
|
|
1075
|
+
C = r(S, A.prev.p, T, X, A.next.next.p, x, F), C && Math.min(w(C, T), w(C, X)) <= x && (k.push(A), k.push(_(C, A)), S.remove(C), F.remove(A), F.insert(u(A)), F.insert(u(A.next)));
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
|
|
1079
|
-
var
|
|
1078
|
+
A = N;
|
|
1079
|
+
var B = [];
|
|
1080
1080
|
do
|
|
1081
|
-
|
|
1082
|
-
while (
|
|
1083
|
-
return
|
|
1084
|
-
}
|
|
1085
|
-
function r(
|
|
1086
|
-
for (var
|
|
1087
|
-
for (var
|
|
1088
|
-
var y =
|
|
1089
|
-
|
|
1081
|
+
B.push(A.p), A = A.next;
|
|
1082
|
+
while (A !== N);
|
|
1083
|
+
return B.push(A.p), B;
|
|
1084
|
+
}
|
|
1085
|
+
function r(p, b, g, E, S, k, P) {
|
|
1086
|
+
for (var N = new t([], s), C = p.data; C; ) {
|
|
1087
|
+
for (var F = 0; F < C.children.length; F++) {
|
|
1088
|
+
var y = C.children[F], I = C.leaf ? O(y, g, E) : a(g, E, y);
|
|
1089
|
+
I > k || N.push({
|
|
1090
1090
|
node: y,
|
|
1091
|
-
dist:
|
|
1091
|
+
dist: I
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
|
-
for (;
|
|
1095
|
-
var
|
|
1096
|
-
if (
|
|
1094
|
+
for (; N.length && !N.peek().node.children; ) {
|
|
1095
|
+
var A = N.pop(), T = A.node, X = O(T, b, g), D = O(T, E, S);
|
|
1096
|
+
if (A.dist < X && A.dist < D && f(g, T, P) && f(E, T, P)) return T;
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1098
|
+
C = N.pop(), C && (C = C.node);
|
|
1099
1099
|
}
|
|
1100
1100
|
return null;
|
|
1101
1101
|
}
|
|
1102
|
-
function s(
|
|
1103
|
-
return
|
|
1102
|
+
function s(p, b) {
|
|
1103
|
+
return p.dist - b.dist;
|
|
1104
1104
|
}
|
|
1105
|
-
function a(
|
|
1106
|
-
if (
|
|
1107
|
-
var
|
|
1108
|
-
if (
|
|
1109
|
-
var S =
|
|
1105
|
+
function a(p, b, g) {
|
|
1106
|
+
if (l(p, g) || l(b, g)) return 0;
|
|
1107
|
+
var E = M(p[0], p[1], b[0], b[1], g.minX, g.minY, g.maxX, g.minY);
|
|
1108
|
+
if (E === 0) return 0;
|
|
1109
|
+
var S = M(p[0], p[1], b[0], b[1], g.minX, g.minY, g.minX, g.maxY);
|
|
1110
1110
|
if (S === 0) return 0;
|
|
1111
|
-
var
|
|
1112
|
-
if (
|
|
1113
|
-
var
|
|
1114
|
-
return
|
|
1111
|
+
var k = M(p[0], p[1], b[0], b[1], g.maxX, g.minY, g.maxX, g.maxY);
|
|
1112
|
+
if (k === 0) return 0;
|
|
1113
|
+
var P = M(p[0], p[1], b[0], b[1], g.minX, g.maxY, g.maxX, g.maxY);
|
|
1114
|
+
return P === 0 ? 0 : Math.min(E, S, k, P);
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1116
|
+
function l(p, b) {
|
|
1117
|
+
return p[0] >= b.minX && p[0] <= b.maxX && p[1] >= b.minY && p[1] <= b.maxY;
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1120
|
-
for (var
|
|
1121
|
-
if (c(
|
|
1119
|
+
function f(p, b, g) {
|
|
1120
|
+
for (var E = Math.min(p[0], b[0]), S = Math.min(p[1], b[1]), k = Math.max(p[0], b[0]), P = Math.max(p[1], b[1]), N = g.search({ minX: E, minY: S, maxX: k, maxY: P }), C = 0; C < N.length; C++)
|
|
1121
|
+
if (c(N[C].p, N[C].next.p, p, b)) return !1;
|
|
1122
1122
|
return !0;
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
return i(
|
|
1124
|
+
function h(p, b, g) {
|
|
1125
|
+
return i(p[0], p[1], b[0], b[1], g[0], g[1]);
|
|
1126
1126
|
}
|
|
1127
|
-
function c(
|
|
1128
|
-
return
|
|
1127
|
+
function c(p, b, g, E) {
|
|
1128
|
+
return p !== E && b !== g && h(p, b, g) > 0 != h(p, b, E) > 0 && h(g, E, p) > 0 != h(g, E, b) > 0;
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
var
|
|
1132
|
-
return
|
|
1130
|
+
function u(p) {
|
|
1131
|
+
var b = p.p, g = p.next.p;
|
|
1132
|
+
return p.minX = Math.min(b[0], g[0]), p.minY = Math.min(b[1], g[1]), p.maxX = Math.max(b[0], g[0]), p.maxY = Math.max(b[1], g[1]), p;
|
|
1133
1133
|
}
|
|
1134
|
-
function p
|
|
1135
|
-
for (var
|
|
1136
|
-
var
|
|
1137
|
-
|
|
1134
|
+
function d(p) {
|
|
1135
|
+
for (var b = p[0], g = p[0], E = p[0], S = p[0], k = 0; k < p.length; k++) {
|
|
1136
|
+
var P = p[k];
|
|
1137
|
+
P[0] < b[0] && (b = P), P[0] > E[0] && (E = P), P[1] < g[1] && (g = P), P[1] > S[1] && (S = P);
|
|
1138
1138
|
}
|
|
1139
|
-
var
|
|
1140
|
-
for (
|
|
1141
|
-
n(
|
|
1142
|
-
return
|
|
1139
|
+
var N = [b, g, E, S], C = N.slice();
|
|
1140
|
+
for (k = 0; k < p.length; k++)
|
|
1141
|
+
n(p[k], N) || C.push(p[k]);
|
|
1142
|
+
return v(C);
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function _(p, b) {
|
|
1145
1145
|
var g = {
|
|
1146
|
-
p
|
|
1146
|
+
p,
|
|
1147
1147
|
prev: null,
|
|
1148
1148
|
next: null,
|
|
1149
1149
|
minX: 0,
|
|
@@ -1151,47 +1151,47 @@ function Li() {
|
|
|
1151
1151
|
maxX: 0,
|
|
1152
1152
|
maxY: 0
|
|
1153
1153
|
};
|
|
1154
|
-
return
|
|
1154
|
+
return b ? (g.next = b.next, g.prev = b, b.next.prev = g, b.next = g) : (g.prev = g, g.next = g), g;
|
|
1155
1155
|
}
|
|
1156
|
-
function w(
|
|
1157
|
-
var g =
|
|
1158
|
-
return g * g +
|
|
1156
|
+
function w(p, b) {
|
|
1157
|
+
var g = p[0] - b[0], E = p[1] - b[1];
|
|
1158
|
+
return g * g + E * E;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
var
|
|
1162
|
-
if (
|
|
1163
|
-
var
|
|
1164
|
-
|
|
1160
|
+
function O(p, b, g) {
|
|
1161
|
+
var E = b[0], S = b[1], k = g[0] - E, P = g[1] - S;
|
|
1162
|
+
if (k !== 0 || P !== 0) {
|
|
1163
|
+
var N = ((p[0] - E) * k + (p[1] - S) * P) / (k * k + P * P);
|
|
1164
|
+
N > 1 ? (E = g[0], S = g[1]) : N > 0 && (E += k * N, S += P * N);
|
|
1165
1165
|
}
|
|
1166
|
-
return
|
|
1167
|
-
}
|
|
1168
|
-
function
|
|
1169
|
-
var
|
|
1170
|
-
|
|
1171
|
-
var Q = (1 - L) *
|
|
1172
|
-
return st * st +
|
|
1173
|
-
}
|
|
1174
|
-
function m(
|
|
1175
|
-
return
|
|
1176
|
-
}
|
|
1177
|
-
function
|
|
1178
|
-
|
|
1179
|
-
for (var
|
|
1180
|
-
for (;
|
|
1181
|
-
|
|
1182
|
-
|
|
1166
|
+
return k = p[0] - E, P = p[1] - S, k * k + P * P;
|
|
1167
|
+
}
|
|
1168
|
+
function M(p, b, g, E, S, k, P, N) {
|
|
1169
|
+
var C = g - p, F = E - b, y = P - S, I = N - k, A = p - S, T = b - k, X = C * C + F * F, D = C * y + F * I, x = y * y + I * I, B = C * A + F * T, $ = y * A + I * T, Y = X * x - D * D, L, V, j, U, G = Y, J = Y;
|
|
1170
|
+
Y === 0 ? (V = 0, G = 1, U = $, J = x) : (V = D * $ - x * B, U = X * $ - D * B, V < 0 ? (V = 0, U = $, J = x) : V > G && (V = G, U = $ + D, J = x)), U < 0 ? (U = 0, -B < 0 ? V = 0 : -B > X ? V = G : (V = -B, G = X)) : U > J && (U = J, -B + D < 0 ? V = 0 : -B + D > X ? V = G : (V = -B + D, G = X)), L = V === 0 ? 0 : V / G, j = U === 0 ? 0 : U / J;
|
|
1171
|
+
var Q = (1 - L) * p + L * g, H = (1 - L) * b + L * E, Z = (1 - j) * S + j * P, W = (1 - j) * k + j * N, st = Z - Q, ft = W - H;
|
|
1172
|
+
return st * st + ft * ft;
|
|
1173
|
+
}
|
|
1174
|
+
function m(p, b) {
|
|
1175
|
+
return p[0] === b[0] ? p[1] - b[1] : p[0] - b[0];
|
|
1176
|
+
}
|
|
1177
|
+
function v(p) {
|
|
1178
|
+
p.sort(m);
|
|
1179
|
+
for (var b = [], g = 0; g < p.length; g++) {
|
|
1180
|
+
for (; b.length >= 2 && h(b[b.length - 2], b[b.length - 1], p[g]) <= 0; )
|
|
1181
|
+
b.pop();
|
|
1182
|
+
b.push(p[g]);
|
|
1183
1183
|
}
|
|
1184
|
-
for (var
|
|
1185
|
-
for (;
|
|
1186
|
-
|
|
1187
|
-
|
|
1184
|
+
for (var E = [], S = p.length - 1; S >= 0; S--) {
|
|
1185
|
+
for (; E.length >= 2 && h(E[E.length - 2], E[E.length - 1], p[S]) <= 0; )
|
|
1186
|
+
E.pop();
|
|
1187
|
+
E.push(p[S]);
|
|
1188
1188
|
}
|
|
1189
|
-
return
|
|
1189
|
+
return E.pop(), b.pop(), b.concat(E);
|
|
1190
1190
|
}
|
|
1191
1191
|
return ye.exports;
|
|
1192
1192
|
}
|
|
1193
|
-
var
|
|
1194
|
-
const
|
|
1193
|
+
var qi = ji();
|
|
1194
|
+
const zi = /* @__PURE__ */ Ti(qi);
|
|
1195
1195
|
function mn(e, t = {}) {
|
|
1196
1196
|
t.concavity = t.concavity || 1 / 0;
|
|
1197
1197
|
const n = [];
|
|
@@ -1199,10 +1199,10 @@ function mn(e, t = {}) {
|
|
|
1199
1199
|
n.push([o[0], o[1]]);
|
|
1200
1200
|
}), !n.length)
|
|
1201
1201
|
return null;
|
|
1202
|
-
const i =
|
|
1202
|
+
const i = zi(n, t.concavity);
|
|
1203
1203
|
return i.length > 3 ? le([i], t.properties) : null;
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function jn(e, t, n = {}) {
|
|
1206
1206
|
const i = { type: "Feature" };
|
|
1207
1207
|
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = t || {}, i.geometry = e, i;
|
|
1208
1208
|
}
|
|
@@ -1215,12 +1215,12 @@ function se(e, t, n = {}) {
|
|
|
1215
1215
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
1216
1216
|
if (!gn(e[0]) || !gn(e[1]))
|
|
1217
1217
|
throw new Error("coordinates must contain numbers");
|
|
1218
|
-
return
|
|
1218
|
+
return jn({
|
|
1219
1219
|
type: "Point",
|
|
1220
1220
|
coordinates: e
|
|
1221
1221
|
}, t, n);
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function qn(e, t, n = {}) {
|
|
1224
1224
|
for (const i of e) {
|
|
1225
1225
|
if (i.length < 4)
|
|
1226
1226
|
throw new Error(
|
|
@@ -1232,7 +1232,7 @@ function jn(e, t, n = {}) {
|
|
|
1232
1232
|
if (i[i.length - 1][o] !== i[0][o])
|
|
1233
1233
|
throw new Error("First and last Position are not equivalent.");
|
|
1234
1234
|
}
|
|
1235
|
-
return
|
|
1235
|
+
return jn({
|
|
1236
1236
|
type: "Polygon",
|
|
1237
1237
|
coordinates: e
|
|
1238
1238
|
}, t, n);
|
|
@@ -1244,7 +1244,7 @@ function Ht(e, t = {}) {
|
|
|
1244
1244
|
function gn(e) {
|
|
1245
1245
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function Ji(e) {
|
|
1248
1248
|
if (!e)
|
|
1249
1249
|
throw new Error("coord is required");
|
|
1250
1250
|
if (!Array.isArray(e)) {
|
|
@@ -1269,136 +1269,144 @@ function wn(e) {
|
|
|
1269
1269
|
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
1270
1270
|
);
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function Gi(e) {
|
|
1273
1273
|
return e.type === "Feature" ? e.geometry : e;
|
|
1274
1274
|
}
|
|
1275
|
-
const Tt = 11102230246251565e-32, dt = 134217729,
|
|
1276
|
-
function
|
|
1277
|
-
let r, s, a,
|
|
1278
|
-
|
|
1279
|
-
let
|
|
1280
|
-
if (c < e &&
|
|
1281
|
-
for (
|
|
1282
|
-
|
|
1275
|
+
const Tt = 11102230246251565e-32, dt = 134217729, Ki = (3 + 8 * Tt) * Tt;
|
|
1276
|
+
function Re(e, t, n, i, o) {
|
|
1277
|
+
let r, s, a, l, f = t[0], h = i[0], c = 0, u = 0;
|
|
1278
|
+
h > f == h > -f ? (r = f, f = t[++c]) : (r = h, h = i[++u]);
|
|
1279
|
+
let d = 0;
|
|
1280
|
+
if (c < e && u < n)
|
|
1281
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++c]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[d++] = a); c < e && u < n; )
|
|
1282
|
+
h > f == h > -f ? (s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u]), r = s, a !== 0 && (o[d++] = a);
|
|
1283
1283
|
for (; c < e; )
|
|
1284
|
-
s = r +
|
|
1285
|
-
for (;
|
|
1286
|
-
s = r +
|
|
1287
|
-
return (r !== 0 ||
|
|
1284
|
+
s = r + f, l = s - r, a = r - (s - l) + (f - l), f = t[++c], r = s, a !== 0 && (o[d++] = a);
|
|
1285
|
+
for (; u < n; )
|
|
1286
|
+
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = i[++u], r = s, a !== 0 && (o[d++] = a);
|
|
1287
|
+
return (r !== 0 || d === 0) && (o[d++] = r), d;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Qi(e, t) {
|
|
1290
1290
|
let n = t[0];
|
|
1291
1291
|
for (let i = 1; i < e; i++) n += t[i];
|
|
1292
1292
|
return n;
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function he(e) {
|
|
1295
1295
|
return new Float64Array(e);
|
|
1296
1296
|
}
|
|
1297
|
-
const
|
|
1298
|
-
function
|
|
1299
|
-
let a,
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
let
|
|
1303
|
-
if (
|
|
1304
|
-
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1309
|
-
const T =
|
|
1297
|
+
const Hi = (3 + 16 * Tt) * Tt, Wi = (2 + 12 * Tt) * Tt, Zi = (9 + 64 * Tt) * Tt * Tt, Gt = he(4), yn = he(8), vn = he(12), bn = he(16), vt = he(4);
|
|
1298
|
+
function tr(e, t, n, i, o, r, s) {
|
|
1299
|
+
let a, l, f, h, c, u, d, _, w, O, M, m, v, p, b, g, E, S;
|
|
1300
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
1301
|
+
p = k * C, u = dt * k, d = u - (u - k), _ = k - d, u = dt * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * P, u = dt * N, d = u - (u - N), _ = N - d, u = dt * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, Gt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, Gt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, Gt[2] = m - (S - c) + (M - c), Gt[3] = S;
|
|
1302
|
+
let F = Qi(4, Gt), y = Wi * s;
|
|
1303
|
+
if (F >= y || -F >= y || (c = e - k, a = e - (k + c) + (c - o), c = n - P, f = n - (P + c) + (c - o), c = t - N, l = t - (N + c) + (c - r), c = i - C, h = i - (C + c) + (c - r), a === 0 && l === 0 && f === 0 && h === 0) || (y = Zi * s + Ki * Math.abs(F), F += k * h + C * a - (N * f + P * l), F >= y || -F >= y)) return F;
|
|
1304
|
+
p = a * C, u = dt * a, d = u - (u - a), _ = a - d, u = dt * C, w = u - (u - C), O = C - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * P, u = dt * l, d = u - (u - l), _ = l - d, u = dt * P, w = u - (u - P), O = P - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, vt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, vt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, vt[2] = m - (S - c) + (M - c), vt[3] = S;
|
|
1305
|
+
const I = Re(4, Gt, 4, vt, yn);
|
|
1306
|
+
p = k * h, u = dt * k, d = u - (u - k), _ = k - d, u = dt * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = N * f, u = dt * N, d = u - (u - N), _ = N - d, u = dt * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, vt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, vt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, vt[2] = m - (S - c) + (M - c), vt[3] = S;
|
|
1307
|
+
const A = Re(I, yn, 4, vt, vn);
|
|
1308
|
+
p = a * h, u = dt * a, d = u - (u - a), _ = a - d, u = dt * h, w = u - (u - h), O = h - w, b = _ * O - (p - d * w - _ * w - d * O), g = l * f, u = dt * l, d = u - (u - l), _ = l - d, u = dt * f, w = u - (u - f), O = f - w, E = _ * O - (g - d * w - _ * w - d * O), M = b - E, c = b - M, vt[0] = b - (M + c) + (c - E), m = p + M, c = m - p, v = p - (m - c) + (M - c), M = v - g, c = v - M, vt[1] = v - (M + c) + (c - g), S = m + M, c = S - m, vt[2] = m - (S - c) + (M - c), vt[3] = S;
|
|
1309
|
+
const T = Re(A, vn, 4, vt, bn);
|
|
1310
1310
|
return bn[T - 1];
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1313
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
1314
|
-
return Math.abs(
|
|
1312
|
+
function er(e, t, n, i, o, r) {
|
|
1313
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), l = s - a, f = Math.abs(s + a);
|
|
1314
|
+
return Math.abs(l) >= Hi * f ? l : -tr(e, t, n, i, o, r, f);
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1317
|
-
var n, i, o = 0, r, s, a,
|
|
1318
|
-
for (n = 0; n <
|
|
1316
|
+
function nr(e, t) {
|
|
1317
|
+
var n, i, o = 0, r, s, a, l, f, h, c, u = e[0], d = e[1], _ = t.length;
|
|
1318
|
+
for (n = 0; n < _; n++) {
|
|
1319
1319
|
i = 0;
|
|
1320
|
-
var w = t[n],
|
|
1321
|
-
if (
|
|
1320
|
+
var w = t[n], O = w.length - 1;
|
|
1321
|
+
if (h = w[0], h[0] !== w[O][0] && h[1] !== w[O][1])
|
|
1322
1322
|
throw new Error("First and last coordinates in a ring must be the same");
|
|
1323
|
-
for (s =
|
|
1324
|
-
if (c = w[i + 1],
|
|
1325
|
-
if (
|
|
1323
|
+
for (s = h[0] - u, a = h[1] - d, i; i < O; i++) {
|
|
1324
|
+
if (c = w[i + 1], l = c[0] - u, f = c[1] - d, a === 0 && f === 0) {
|
|
1325
|
+
if (l <= 0 && s >= 0 || s <= 0 && l >= 0)
|
|
1326
1326
|
return 0;
|
|
1327
|
-
} else if (
|
|
1328
|
-
if (r =
|
|
1327
|
+
} else if (f >= 0 && a <= 0 || f <= 0 && a >= 0) {
|
|
1328
|
+
if (r = er(s, l, a, f, 0, 0), r === 0)
|
|
1329
1329
|
return 0;
|
|
1330
|
-
(r > 0 &&
|
|
1330
|
+
(r > 0 && f > 0 && a <= 0 || r < 0 && f <= 0 && a > 0) && o++;
|
|
1331
1331
|
}
|
|
1332
|
-
|
|
1332
|
+
h = c, a = f, s = l;
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
1335
|
return o % 2 !== 0;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Ue(e, t, n = {}) {
|
|
1338
1338
|
if (!e)
|
|
1339
1339
|
throw new Error("point is required");
|
|
1340
1340
|
if (!t)
|
|
1341
1341
|
throw new Error("polygon is required");
|
|
1342
|
-
const i =
|
|
1342
|
+
const i = Ji(e), o = Gi(t), r = o.type, s = t.bbox;
|
|
1343
1343
|
let a = o.coordinates;
|
|
1344
|
-
if (s &&
|
|
1344
|
+
if (s && ir(i, s) === !1)
|
|
1345
1345
|
return !1;
|
|
1346
1346
|
r === "Polygon" && (a = [a]);
|
|
1347
|
-
for (var
|
|
1348
|
-
const
|
|
1349
|
-
if (
|
|
1347
|
+
for (var l = 0; l < a.length; ++l) {
|
|
1348
|
+
const f = nr(i, a[l]);
|
|
1349
|
+
if (f === 0 && !n.ignoreBoundary || f) return !0;
|
|
1350
1350
|
}
|
|
1351
1351
|
return !1;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function ir(e, t) {
|
|
1354
1354
|
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
|
|
1355
1355
|
}
|
|
1356
1356
|
function Le(e, t) {
|
|
1357
1357
|
for (let n = 0; n < t.features.length; n++)
|
|
1358
|
-
if (
|
|
1358
|
+
if (Ue(e, t.features[n]))
|
|
1359
1359
|
return t.features[n];
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const n = t.geometry.coordinates[0][0], i = t.geometry.coordinates[0][1], o = t.geometry.coordinates[0][2], r = e.geometry.coordinates, s = t.properties.a.geom, a = t.properties.b.geom,
|
|
1361
|
+
function zn(e, t) {
|
|
1362
|
+
const n = t.geometry.coordinates[0][0], i = t.geometry.coordinates[0][1], o = t.geometry.coordinates[0][2], r = e.geometry.coordinates, s = t.properties.a.geom, a = t.properties.b.geom, l = t.properties.c.geom, f = [i[0] - n[0], i[1] - n[1]], h = [o[0] - n[0], o[1] - n[1]], c = [r[0] - n[0], r[1] - n[1]], u = [a[0] - s[0], a[1] - s[1]], d = [l[0] - s[0], l[1] - s[1]], _ = (h[1] * c[0] - h[0] * c[1]) / (f[0] * h[1] - f[1] * h[0]), w = (f[0] * c[1] - f[1] * c[0]) / (f[0] * h[1] - f[1] * h[0]);
|
|
1363
1363
|
return [
|
|
1364
|
-
|
|
1365
|
-
|
|
1364
|
+
_ * u[0] + w * d[0] + s[0],
|
|
1365
|
+
_ * u[1] + w * d[1] + s[1]
|
|
1366
1366
|
];
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const i = e.geometry.coordinates, o = n.geometry.coordinates, r = Math.atan2(i[0] - o[0], i[1] - o[1]), s =
|
|
1368
|
+
function rr(e, t, n) {
|
|
1369
|
+
const i = e.geometry.coordinates, o = n.geometry.coordinates, r = Math.atan2(i[0] - o[0], i[1] - o[1]), s = sr(r, t[0]);
|
|
1370
1370
|
if (s === void 0)
|
|
1371
1371
|
throw new Error("Unable to determine vertex index");
|
|
1372
1372
|
const a = t[1][s];
|
|
1373
|
-
return
|
|
1373
|
+
return zn(e, a.features[0]);
|
|
1374
1374
|
}
|
|
1375
1375
|
function ne(e, t, n, i, o, r, s, a) {
|
|
1376
|
-
let
|
|
1377
|
-
if (s && (
|
|
1376
|
+
let l;
|
|
1377
|
+
if (s && (l = Le(e, Ht([s]))), !l)
|
|
1378
1378
|
if (n) {
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1379
|
+
const f = e.geometry.coordinates, h = n.gridNum, c = n.xOrigin, u = n.yOrigin, d = n.xUnit, _ = n.yUnit, w = n.gridCache, O = xt(f[0], c, d, h), M = xt(f[1], u, _, h), m = w[O] ? w[O][M] ? w[O][M] : [] : [], v = Ht(m.map((p) => t.features[p]));
|
|
1380
|
+
l = Le(e, v);
|
|
1381
1381
|
} else
|
|
1382
|
-
|
|
1383
|
-
return a && a(
|
|
1382
|
+
l = Le(e, t);
|
|
1383
|
+
return a && a(l), l ? zn(e, l) : rr(e, i, o);
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function xt(e, t, n, i) {
|
|
1386
1386
|
let o = Math.floor((e - t) / n);
|
|
1387
1387
|
return o < 0 && (o = 0), o >= i && (o = i - 1), o;
|
|
1388
1388
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1389
|
+
const or = 36;
|
|
1390
|
+
function xn(e, t, n) {
|
|
1391
|
+
const i = (t[1][0] - t[0][0]) / n, o = (t[1][1] - t[0][1]) / n;
|
|
1392
|
+
return e.reduce((r, s) => {
|
|
1393
|
+
const a = xt(s[0][0], t[0][0], i, n), l = xt(s[1][0], t[0][0], i, n), f = xt(s[0][1], t[0][1], o, n), h = xt(s[1][1], t[0][1], o, n), c = (l - a + 1) * (h - f + 1);
|
|
1394
|
+
return c > 0 ? r + c : r;
|
|
1395
|
+
}, 0);
|
|
1396
|
+
}
|
|
1397
|
+
function sr(e, t) {
|
|
1398
|
+
let n = _n(e - t[0]), i = Math.PI * 2, o;
|
|
1391
1399
|
for (let r = 0; r < t.length; r++) {
|
|
1392
|
-
const s = (r + 1) % t.length, a =
|
|
1393
|
-
n * a <= 0 &&
|
|
1400
|
+
const s = (r + 1) % t.length, a = _n(e - t[s]), l = Math.min(Math.abs(n), Math.abs(a));
|
|
1401
|
+
n * a <= 0 && l < i && (i = l, o = r), n = a;
|
|
1394
1402
|
}
|
|
1395
1403
|
return o;
|
|
1396
1404
|
}
|
|
1397
|
-
function
|
|
1405
|
+
function _n(e, t = !1) {
|
|
1398
1406
|
const n = 2 * Math.PI, i = e - Math.floor(e / n) * n;
|
|
1399
1407
|
return t ? i : i > Math.PI ? i - n : i;
|
|
1400
1408
|
}
|
|
1401
|
-
function
|
|
1409
|
+
function Mn(e) {
|
|
1402
1410
|
const t = e.features;
|
|
1403
1411
|
for (let n = 0; n < t.length; n++) {
|
|
1404
1412
|
const i = t[n];
|
|
@@ -1460,7 +1468,7 @@ function _n(e) {
|
|
|
1460
1468
|
}
|
|
1461
1469
|
return e;
|
|
1462
1470
|
}
|
|
1463
|
-
function
|
|
1471
|
+
function Jn(e) {
|
|
1464
1472
|
const t = ["a", "b", "c", "a"].map(
|
|
1465
1473
|
(r) => e.properties[r].geom
|
|
1466
1474
|
), n = e.geometry.coordinates[0], i = e.properties, o = {
|
|
@@ -1468,56 +1476,56 @@ function Un(e) {
|
|
|
1468
1476
|
b: { geom: n[1], index: i.b.index },
|
|
1469
1477
|
c: { geom: n[2], index: i.c.index }
|
|
1470
1478
|
};
|
|
1471
|
-
return
|
|
1479
|
+
return qn([t], o);
|
|
1472
1480
|
}
|
|
1473
|
-
function
|
|
1481
|
+
function ar(e) {
|
|
1474
1482
|
const t = [0, 1, 2, 0].map((i) => e[i][0][0]), n = {
|
|
1475
1483
|
a: { geom: e[0][0][1], index: e[0][1] },
|
|
1476
1484
|
b: { geom: e[1][0][1], index: e[1][1] },
|
|
1477
1485
|
c: { geom: e[2][0][1], index: e[2][1] }
|
|
1478
1486
|
};
|
|
1479
|
-
return
|
|
1487
|
+
return qn([t], n);
|
|
1480
1488
|
}
|
|
1481
|
-
function
|
|
1489
|
+
function je(e, t, n, i, o, r = !1, s) {
|
|
1482
1490
|
const a = e.map(
|
|
1483
|
-
(
|
|
1484
|
-
(!s || s < 2.00703) && (
|
|
1485
|
-
const
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
const c =
|
|
1491
|
+
(l) => {
|
|
1492
|
+
(!s || s < 2.00703) && (l = cr(l));
|
|
1493
|
+
const f = isFinite(l) ? t[l] : l === "c" ? i : (function() {
|
|
1494
|
+
const h = l.match(/^b(\d+)$/);
|
|
1495
|
+
if (h) return o[parseInt(h[1])];
|
|
1496
|
+
const c = l.match(/^e(\d+)$/);
|
|
1489
1497
|
if (c) return n[parseInt(c[1])];
|
|
1490
1498
|
throw new Error("Bad index value for indexesToTri");
|
|
1491
1499
|
})();
|
|
1492
|
-
return r ? [[
|
|
1500
|
+
return r ? [[f[1], f[0]], l] : [[f[0], f[1]], l];
|
|
1493
1501
|
}
|
|
1494
1502
|
);
|
|
1495
|
-
return
|
|
1503
|
+
return ar(a);
|
|
1496
1504
|
}
|
|
1497
|
-
function
|
|
1505
|
+
function cr(e) {
|
|
1498
1506
|
return typeof e == "number" ? e : e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
|
|
1499
1507
|
}
|
|
1500
|
-
function
|
|
1508
|
+
function Gn(e, t) {
|
|
1501
1509
|
return t && t >= 2.00703 || Array.isArray(e[0]) ? e : e.map((n) => [
|
|
1502
1510
|
n.illstNodes,
|
|
1503
1511
|
n.mercNodes,
|
|
1504
1512
|
n.startEnd
|
|
1505
1513
|
]);
|
|
1506
1514
|
}
|
|
1507
|
-
const
|
|
1508
|
-
function
|
|
1515
|
+
const lr = 2.00704;
|
|
1516
|
+
function fr(e) {
|
|
1509
1517
|
return !!(e.version !== void 0 || !e.tins && e.points && e.tins_points);
|
|
1510
1518
|
}
|
|
1511
|
-
function
|
|
1519
|
+
function hr(e) {
|
|
1512
1520
|
return {
|
|
1513
1521
|
points: e.points,
|
|
1514
|
-
strictStatus:
|
|
1515
|
-
verticesParams:
|
|
1516
|
-
centroid:
|
|
1517
|
-
edges:
|
|
1522
|
+
strictStatus: dr(e),
|
|
1523
|
+
verticesParams: pr(e),
|
|
1524
|
+
centroid: mr(e),
|
|
1525
|
+
edges: Gn(e.edges || []),
|
|
1518
1526
|
edgeNodes: e.edgeNodes || [],
|
|
1519
|
-
tins:
|
|
1520
|
-
kinks:
|
|
1527
|
+
tins: gr(e),
|
|
1528
|
+
kinks: wr(e.kinks_points),
|
|
1521
1529
|
yaxisMode: e.yaxisMode ?? "invert",
|
|
1522
1530
|
strictMode: e.strictMode ?? "auto",
|
|
1523
1531
|
vertexMode: e.vertexMode,
|
|
@@ -1527,44 +1535,68 @@ function ar(e) {
|
|
|
1527
1535
|
xy: e.xy ?? [0, 0]
|
|
1528
1536
|
};
|
|
1529
1537
|
}
|
|
1530
|
-
function
|
|
1531
|
-
const t =
|
|
1532
|
-
return {
|
|
1538
|
+
function ur(e) {
|
|
1539
|
+
const t = yr(e), n = t.tins, i = t.vertices_params;
|
|
1540
|
+
return i != null && Kn(i), {
|
|
1533
1541
|
compiled: t,
|
|
1534
1542
|
tins: n,
|
|
1535
|
-
points:
|
|
1543
|
+
points: vr(n),
|
|
1536
1544
|
strictStatus: t.strict_status,
|
|
1537
|
-
verticesParams:
|
|
1545
|
+
verticesParams: i,
|
|
1538
1546
|
centroid: t.centroid,
|
|
1539
1547
|
kinks: t.kinks
|
|
1540
1548
|
};
|
|
1541
1549
|
}
|
|
1542
|
-
function
|
|
1550
|
+
function dr(e) {
|
|
1543
1551
|
return e.strict_status ? e.strict_status : e.kinks_points ? "strict_error" : e.tins_points.length === 2 ? "loose" : "strict";
|
|
1544
1552
|
}
|
|
1545
|
-
function
|
|
1553
|
+
function pr(e) {
|
|
1554
|
+
if (!Array.isArray(e.vertices_params) || !Array.isArray(e.vertices_points))
|
|
1555
|
+
throw new Error(
|
|
1556
|
+
"Invalid compiled data: vertices_params and vertices_points must be arrays"
|
|
1557
|
+
);
|
|
1546
1558
|
const t = {
|
|
1547
1559
|
forw: [e.vertices_params[0]],
|
|
1548
1560
|
bakw: [e.vertices_params[1]]
|
|
1549
1561
|
};
|
|
1550
|
-
return t.forw[1] =
|
|
1562
|
+
return t.forw[1] = Sn(e, !1), t.bakw[1] = Sn(e, !0), Kn(t), t;
|
|
1563
|
+
}
|
|
1564
|
+
function Kn(e) {
|
|
1565
|
+
if (typeof e != "object")
|
|
1566
|
+
throw new Error("Invalid compiled data: vertices_params has a wrong shape");
|
|
1567
|
+
["forw", "bakw"].forEach((t) => {
|
|
1568
|
+
const n = e[t];
|
|
1569
|
+
if (n == null) return;
|
|
1570
|
+
const i = `vertices_params.${t}`, o = n[0], r = n[1];
|
|
1571
|
+
if (!Array.isArray(o) || !Array.isArray(r))
|
|
1572
|
+
throw new Error(`Invalid compiled data: ${i} must hold two arrays`);
|
|
1573
|
+
if (o.length !== r.length)
|
|
1574
|
+
throw new Error(
|
|
1575
|
+
`Invalid compiled data: ${i} must have one angle per vertex`
|
|
1576
|
+
);
|
|
1577
|
+
for (let s = 0; s < o.length; s++)
|
|
1578
|
+
if (typeof o[s] != "number" || !Number.isFinite(o[s]))
|
|
1579
|
+
throw new Error(
|
|
1580
|
+
`Invalid compiled data: ${i} must contain only finite numbers`
|
|
1581
|
+
);
|
|
1582
|
+
});
|
|
1551
1583
|
}
|
|
1552
|
-
function
|
|
1584
|
+
function Sn(e, t) {
|
|
1553
1585
|
const n = e.vertices_points.length;
|
|
1554
1586
|
return Array.from({ length: n }, (i, o) => {
|
|
1555
|
-
const r = (o + 1) % n, s =
|
|
1587
|
+
const r = (o + 1) % n, s = je(
|
|
1556
1588
|
["c", `b${o}`, `b${r}`],
|
|
1557
1589
|
e.points,
|
|
1558
1590
|
e.edgeNodes || [],
|
|
1559
1591
|
e.centroid_point,
|
|
1560
1592
|
e.vertices_points,
|
|
1561
1593
|
t,
|
|
1562
|
-
|
|
1594
|
+
lr
|
|
1563
1595
|
);
|
|
1564
1596
|
return Ht([s]);
|
|
1565
1597
|
});
|
|
1566
1598
|
}
|
|
1567
|
-
function
|
|
1599
|
+
function mr(e) {
|
|
1568
1600
|
return {
|
|
1569
1601
|
forw: se(e.centroid_point[0], {
|
|
1570
1602
|
target: {
|
|
@@ -1580,12 +1612,12 @@ function fr(e) {
|
|
|
1580
1612
|
})
|
|
1581
1613
|
};
|
|
1582
1614
|
}
|
|
1583
|
-
function
|
|
1615
|
+
function gr(e) {
|
|
1584
1616
|
const t = e.tins_points.length === 1 ? 0 : 1;
|
|
1585
1617
|
return {
|
|
1586
1618
|
forw: Ht(
|
|
1587
1619
|
e.tins_points[0].map(
|
|
1588
|
-
(n) =>
|
|
1620
|
+
(n) => je(
|
|
1589
1621
|
n,
|
|
1590
1622
|
e.points,
|
|
1591
1623
|
e.edgeNodes || [],
|
|
@@ -1598,7 +1630,7 @@ function ur(e) {
|
|
|
1598
1630
|
),
|
|
1599
1631
|
bakw: Ht(
|
|
1600
1632
|
e.tins_points[t].map(
|
|
1601
|
-
(n) =>
|
|
1633
|
+
(n) => je(
|
|
1602
1634
|
n,
|
|
1603
1635
|
e.points,
|
|
1604
1636
|
e.edgeNodes || [],
|
|
@@ -1611,7 +1643,7 @@ function ur(e) {
|
|
|
1611
1643
|
)
|
|
1612
1644
|
};
|
|
1613
1645
|
}
|
|
1614
|
-
function
|
|
1646
|
+
function wr(e) {
|
|
1615
1647
|
if (e)
|
|
1616
1648
|
return {
|
|
1617
1649
|
bakw: Ht(
|
|
@@ -1619,23 +1651,23 @@ function dr(e) {
|
|
|
1619
1651
|
)
|
|
1620
1652
|
};
|
|
1621
1653
|
}
|
|
1622
|
-
function
|
|
1654
|
+
function yr(e) {
|
|
1623
1655
|
return JSON.parse(
|
|
1624
1656
|
JSON.stringify(e).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
|
|
1625
1657
|
);
|
|
1626
1658
|
}
|
|
1627
|
-
function
|
|
1659
|
+
function vr(e) {
|
|
1628
1660
|
const t = [], n = e.forw.features;
|
|
1629
1661
|
for (let i = 0; i < n.length; i++) {
|
|
1630
1662
|
const o = n[i];
|
|
1631
1663
|
["a", "b", "c"].forEach((r, s) => {
|
|
1632
|
-
const a = o.geometry.coordinates[0][s],
|
|
1633
|
-
typeof
|
|
1664
|
+
const a = o.geometry.coordinates[0][s], l = o.properties[r].geom, f = o.properties[r].index;
|
|
1665
|
+
typeof f == "number" && (t[f] = [a, l]);
|
|
1634
1666
|
});
|
|
1635
1667
|
}
|
|
1636
1668
|
return t;
|
|
1637
1669
|
}
|
|
1638
|
-
class
|
|
1670
|
+
class St {
|
|
1639
1671
|
/**
|
|
1640
1672
|
* 各種モードの定数定義
|
|
1641
1673
|
* すべてreadonlyで、型安全性を確保
|
|
@@ -1651,7 +1683,7 @@ class Mt {
|
|
|
1651
1683
|
static YAXIS_FOLLOW = "follow";
|
|
1652
1684
|
static YAXIS_INVERT = "invert";
|
|
1653
1685
|
points = [];
|
|
1654
|
-
/** @deprecated 2.00704 以降、Transform はこのプロパティを設定も参照もしない。サブクラス(MaplatTin)は、旧 @maplat/transform と組まれたときの互換のため {}
|
|
1686
|
+
/** @deprecated 2.00704 以降、Transform はこのプロパティを設定も参照もしない。サブクラス(MaplatTin)は、旧 @maplat/transform と組まれたときの互換のため {} を入れる */
|
|
1655
1687
|
pointsWeightBuffer;
|
|
1656
1688
|
strict_status;
|
|
1657
1689
|
vertices_params;
|
|
@@ -1660,9 +1692,9 @@ class Mt {
|
|
|
1660
1692
|
edges;
|
|
1661
1693
|
tins;
|
|
1662
1694
|
kinks;
|
|
1663
|
-
yaxisMode =
|
|
1664
|
-
strictMode =
|
|
1665
|
-
vertexMode =
|
|
1695
|
+
yaxisMode = St.YAXIS_INVERT;
|
|
1696
|
+
strictMode = St.MODE_AUTO;
|
|
1697
|
+
vertexMode = St.VERTEX_PLAIN;
|
|
1666
1698
|
bounds;
|
|
1667
1699
|
boundsPolygon;
|
|
1668
1700
|
wh;
|
|
@@ -1699,14 +1731,14 @@ class Mt {
|
|
|
1699
1731
|
* 4. インデックスの作成
|
|
1700
1732
|
*/
|
|
1701
1733
|
setCompiled(t) {
|
|
1702
|
-
if (
|
|
1703
|
-
this.applyModernState(
|
|
1734
|
+
if (fr(t)) {
|
|
1735
|
+
this.applyModernState(hr(t));
|
|
1704
1736
|
return;
|
|
1705
1737
|
}
|
|
1706
|
-
this.applyLegacyState(
|
|
1738
|
+
this.applyLegacyState(ur(t));
|
|
1707
1739
|
}
|
|
1708
1740
|
applyModernState(t) {
|
|
1709
|
-
this.points = t.points, this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.edges = t.edges, this.edgeNodes = t.edgeNodes || [], this.tins = t.tins, this.addIndexedTin(), this.kinks = t.kinks, this.yaxisMode = t.yaxisMode ??
|
|
1741
|
+
this.points = t.points, this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.edges = t.edges, this.edgeNodes = t.edgeNodes || [], this.tins = t.tins, this.addIndexedTin(), this.kinks = t.kinks, this.yaxisMode = t.yaxisMode ?? St.YAXIS_INVERT, this.vertexMode = t.vertexMode ?? St.VERTEX_PLAIN, this.strictMode = t.strictMode ?? St.MODE_AUTO, t.bounds ? (this.bounds = t.bounds, this.boundsPolygon = t.boundsPolygon, this.xy = t.xy, this.wh = t.wh) : (this.bounds = void 0, this.boundsPolygon = void 0, this.xy = t.xy ?? [0, 0], t.wh && (this.wh = t.wh));
|
|
1710
1742
|
}
|
|
1711
1743
|
applyLegacyState(t) {
|
|
1712
1744
|
this.tins = t.tins, this.addIndexedTin(), this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.kinks = t.kinks, this.points = t.points;
|
|
@@ -1717,6 +1749,8 @@ class Mt {
|
|
|
1717
1749
|
* インデックスは変換処理を高速化するために使用されます。
|
|
1718
1750
|
* グリッド形式のインデックスを作成し、各グリッドに
|
|
1719
1751
|
* 含まれる三角形を記録します。
|
|
1752
|
+
* セル数が MAX_INDEX_CELLS_PER_TRIANGLE で決まる上限を超えるデータは
|
|
1753
|
+
* 索引を作らず、変換時に全三角形を線形に探します。
|
|
1720
1754
|
*/
|
|
1721
1755
|
addIndexedTin() {
|
|
1722
1756
|
const t = this.tins, n = t.forw, i = t.bakw, o = Math.ceil(Math.sqrt(n.features.length));
|
|
@@ -1726,33 +1760,41 @@ class Mt {
|
|
|
1726
1760
|
}
|
|
1727
1761
|
let r = [], s = [];
|
|
1728
1762
|
const a = n.features.map((w) => {
|
|
1729
|
-
let
|
|
1730
|
-
return wn(w)[0].map((
|
|
1731
|
-
r.length === 0 ? r = [Array.from(
|
|
1732
|
-
}),
|
|
1733
|
-
}),
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1763
|
+
let O = [];
|
|
1764
|
+
return wn(w)[0].map((M) => {
|
|
1765
|
+
r.length === 0 ? r = [Array.from(M), Array.from(M)] : (M[0] < r[0][0] && (r[0][0] = M[0]), M[0] > r[1][0] && (r[1][0] = M[0]), M[1] < r[0][1] && (r[0][1] = M[1]), M[1] > r[1][1] && (r[1][1] = M[1])), O.length === 0 ? O = [Array.from(M), Array.from(M)] : (M[0] < O[0][0] && (O[0][0] = M[0]), M[0] > O[1][0] && (O[1][0] = M[0]), M[1] < O[0][1] && (O[0][1] = M[1]), M[1] > O[1][1] && (O[1][1] = M[1]));
|
|
1766
|
+
}), O;
|
|
1767
|
+
}), l = i.features.map((w) => {
|
|
1768
|
+
let O = [];
|
|
1769
|
+
return wn(w)[0].map((M) => {
|
|
1770
|
+
s.length === 0 ? s = [Array.from(M), Array.from(M)] : (M[0] < s[0][0] && (s[0][0] = M[0]), M[0] > s[1][0] && (s[1][0] = M[0]), M[1] < s[0][1] && (s[0][1] = M[1]), M[1] > s[1][1] && (s[1][1] = M[1])), O.length === 0 ? O = [Array.from(M), Array.from(M)] : (M[0] < O[0][0] && (O[0][0] = M[0]), M[0] > O[1][0] && (O[1][0] = M[0]), M[1] < O[0][1] && (O[0][1] = M[1]), M[1] > O[1][1] && (O[1][1] = M[1]));
|
|
1771
|
+
}), O;
|
|
1772
|
+
});
|
|
1773
|
+
if (Math.max(
|
|
1774
|
+
xn(a, r, o),
|
|
1775
|
+
xn(l, s, o)
|
|
1776
|
+
) > or * n.features.length) {
|
|
1777
|
+
this.indexedTins = void 0;
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
const f = (r[1][0] - r[0][0]) / o, h = (r[1][1] - r[0][1]) / o, c = a.reduce(
|
|
1781
|
+
(w, O, M) => {
|
|
1782
|
+
const m = xt(O[0][0], r[0][0], f, o), v = xt(O[1][0], r[0][0], f, o), p = xt(O[0][1], r[0][1], h, o), b = xt(O[1][1], r[0][1], h, o);
|
|
1783
|
+
for (let g = m; g <= v; g++) {
|
|
1737
1784
|
w[g] || (w[g] = []);
|
|
1738
|
-
for (let
|
|
1739
|
-
w[g][
|
|
1785
|
+
for (let E = p; E <= b; E++)
|
|
1786
|
+
w[g][E] || (w[g][E] = []), w[g][E].push(M);
|
|
1740
1787
|
}
|
|
1741
1788
|
return w;
|
|
1742
1789
|
},
|
|
1743
1790
|
[]
|
|
1744
|
-
),
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
}), I;
|
|
1749
|
-
}), f = (s[1][0] - s[0][0]) / o, p = (s[1][1] - s[0][1]) / o, M = c.reduce(
|
|
1750
|
-
(w, I, x) => {
|
|
1751
|
-
const m = It(I[0][0], s[0][0], f, o), _ = It(I[1][0], s[0][0], f, o), d = It(I[0][1], s[0][1], p, o), v = It(I[1][1], s[0][1], p, o);
|
|
1752
|
-
for (let g = m; g <= _; g++) {
|
|
1791
|
+
), u = (s[1][0] - s[0][0]) / o, d = (s[1][1] - s[0][1]) / o, _ = l.reduce(
|
|
1792
|
+
(w, O, M) => {
|
|
1793
|
+
const m = xt(O[0][0], s[0][0], u, o), v = xt(O[1][0], s[0][0], u, o), p = xt(O[0][1], s[0][1], d, o), b = xt(O[1][1], s[0][1], d, o);
|
|
1794
|
+
for (let g = m; g <= v; g++) {
|
|
1753
1795
|
w[g] || (w[g] = []);
|
|
1754
|
-
for (let
|
|
1755
|
-
w[g][
|
|
1796
|
+
for (let E = p; E <= b; E++)
|
|
1797
|
+
w[g][E] || (w[g][E] = []), w[g][E].push(M);
|
|
1756
1798
|
}
|
|
1757
1799
|
return w;
|
|
1758
1800
|
},
|
|
@@ -1763,17 +1805,17 @@ class Mt {
|
|
|
1763
1805
|
gridNum: o,
|
|
1764
1806
|
xOrigin: r[0][0],
|
|
1765
1807
|
yOrigin: r[0][1],
|
|
1766
|
-
xUnit:
|
|
1767
|
-
yUnit:
|
|
1768
|
-
gridCache:
|
|
1808
|
+
xUnit: f,
|
|
1809
|
+
yUnit: h,
|
|
1810
|
+
gridCache: c
|
|
1769
1811
|
},
|
|
1770
1812
|
bakw: {
|
|
1771
1813
|
gridNum: o,
|
|
1772
1814
|
xOrigin: s[0][0],
|
|
1773
1815
|
yOrigin: s[0][1],
|
|
1774
|
-
xUnit:
|
|
1775
|
-
yUnit:
|
|
1776
|
-
gridCache:
|
|
1816
|
+
xUnit: u,
|
|
1817
|
+
yUnit: d,
|
|
1818
|
+
gridCache: _
|
|
1777
1819
|
}
|
|
1778
1820
|
};
|
|
1779
1821
|
}
|
|
@@ -1790,36 +1832,36 @@ class Mt {
|
|
|
1790
1832
|
transform(t, n, i) {
|
|
1791
1833
|
if (!this.tins)
|
|
1792
1834
|
throw new Error("setCompiled() must be called before transform()");
|
|
1793
|
-
if (n && this.strict_status ==
|
|
1835
|
+
if (n && this.strict_status == St.STATUS_ERROR)
|
|
1794
1836
|
throw new Error('Backward transform is not allowed if strict_status == "strict_error"');
|
|
1795
|
-
this.yaxisMode ==
|
|
1837
|
+
this.yaxisMode == St.YAXIS_FOLLOW && n && (t = [t[0], -1 * t[1]]);
|
|
1796
1838
|
const o = se(t);
|
|
1797
|
-
if (this.bounds && !n && !i && !
|
|
1839
|
+
if (this.bounds && !n && !i && !Ue(o, this.boundsPolygon))
|
|
1798
1840
|
return !1;
|
|
1799
|
-
const r = n ? this.tins.bakw : this.tins.forw, s = n ? this.indexedTins
|
|
1800
|
-
let
|
|
1801
|
-
this.stateFull && (this.stateBackward == n ?
|
|
1802
|
-
this.stateTriangle =
|
|
1841
|
+
const r = n ? this.tins.bakw : this.tins.forw, s = n ? this.indexedTins?.bakw : this.indexedTins?.forw, a = n ? this.vertices_params.bakw : this.vertices_params.forw, l = n ? this.centroid.bakw : this.centroid.forw;
|
|
1842
|
+
let f, h;
|
|
1843
|
+
this.stateFull && (this.stateBackward == n ? f = this.stateTriangle : (this.stateBackward = n, this.stateTriangle = void 0), h = (u) => {
|
|
1844
|
+
this.stateTriangle = u;
|
|
1803
1845
|
});
|
|
1804
1846
|
let c = ne(
|
|
1805
1847
|
o,
|
|
1806
1848
|
r,
|
|
1807
1849
|
s,
|
|
1808
1850
|
a,
|
|
1809
|
-
h,
|
|
1810
|
-
void 0,
|
|
1811
1851
|
l,
|
|
1812
|
-
|
|
1852
|
+
void 0,
|
|
1853
|
+
f,
|
|
1854
|
+
h
|
|
1813
1855
|
);
|
|
1814
1856
|
if (this.bounds && n && !i) {
|
|
1815
|
-
const
|
|
1816
|
-
if (!
|
|
1817
|
-
} else this.yaxisMode ==
|
|
1857
|
+
const u = se(c);
|
|
1858
|
+
if (!Ue(u, this.boundsPolygon)) return !1;
|
|
1859
|
+
} else this.yaxisMode == St.YAXIS_FOLLOW && !n && (c = [c[0], -1 * c[1]]);
|
|
1818
1860
|
return c;
|
|
1819
1861
|
}
|
|
1820
1862
|
}
|
|
1821
|
-
const
|
|
1822
|
-
class
|
|
1863
|
+
const En = Math.pow(2, -52), ve = new Uint32Array(512);
|
|
1864
|
+
class Ge {
|
|
1823
1865
|
/**
|
|
1824
1866
|
* Constructs a delaunay triangulation object given an array of points (`[x, y]` by default).
|
|
1825
1867
|
* `getX` and `getY` are optional functions of the form `(point) => value` for custom point formats.
|
|
@@ -1830,13 +1872,13 @@ class Je {
|
|
|
1830
1872
|
* @param {(p: P) => number} [getY]
|
|
1831
1873
|
*/
|
|
1832
1874
|
// @ts-expect-error TS2322
|
|
1833
|
-
static from(t, n =
|
|
1875
|
+
static from(t, n = Sr, i = Er) {
|
|
1834
1876
|
const o = t.length, r = new Float64Array(o * 2);
|
|
1835
1877
|
for (let s = 0; s < o; s++) {
|
|
1836
1878
|
const a = t[s];
|
|
1837
1879
|
r[2 * s] = n(a), r[2 * s + 1] = i(a);
|
|
1838
1880
|
}
|
|
1839
|
-
return new
|
|
1881
|
+
return new Ge(r);
|
|
1840
1882
|
}
|
|
1841
1883
|
/**
|
|
1842
1884
|
* Constructs a delaunay triangulation object given an array of point coordinates of the form:
|
|
@@ -1857,81 +1899,81 @@ class Je {
|
|
|
1857
1899
|
*/
|
|
1858
1900
|
update() {
|
|
1859
1901
|
const { coords: t, _hullPrev: n, _hullNext: i, _hullTri: o, _hullHash: r } = this, s = t.length >> 1;
|
|
1860
|
-
let a = 1 / 0,
|
|
1861
|
-
for (let
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1902
|
+
let a = 1 / 0, l = 1 / 0, f = -1 / 0, h = -1 / 0;
|
|
1903
|
+
for (let k = 0; k < s; k++) {
|
|
1904
|
+
const P = t[2 * k], N = t[2 * k + 1];
|
|
1905
|
+
P < a && (a = P), N < l && (l = N), P > f && (f = P), N > h && (h = N), this._ids[k] = k;
|
|
1864
1906
|
}
|
|
1865
|
-
const c = (a +
|
|
1866
|
-
let
|
|
1867
|
-
for (let
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1907
|
+
const c = (a + f) / 2, u = (l + h) / 2;
|
|
1908
|
+
let d = 0, _ = 0, w = 0;
|
|
1909
|
+
for (let k = 0, P = 1 / 0; k < s; k++) {
|
|
1910
|
+
const N = Ve(c, u, t[2 * k], t[2 * k + 1]);
|
|
1911
|
+
N < P && (d = k, P = N);
|
|
1870
1912
|
}
|
|
1871
|
-
const
|
|
1872
|
-
for (let
|
|
1873
|
-
if (
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1913
|
+
const O = t[2 * d], M = t[2 * d + 1];
|
|
1914
|
+
for (let k = 0, P = 1 / 0; k < s; k++) {
|
|
1915
|
+
if (k === d) continue;
|
|
1916
|
+
const N = Ve(O, M, t[2 * k], t[2 * k + 1]);
|
|
1917
|
+
N < P && N > 0 && (_ = k, P = N);
|
|
1876
1918
|
}
|
|
1877
|
-
let m = t[2 *
|
|
1878
|
-
for (let
|
|
1879
|
-
if (
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1919
|
+
let m = t[2 * _], v = t[2 * _ + 1], p = 1 / 0;
|
|
1920
|
+
for (let k = 0; k < s; k++) {
|
|
1921
|
+
if (k === d || k === _) continue;
|
|
1922
|
+
const P = _r(O, M, m, v, t[2 * k], t[2 * k + 1]);
|
|
1923
|
+
P < p && (w = k, p = P);
|
|
1882
1924
|
}
|
|
1883
|
-
let
|
|
1884
|
-
if (
|
|
1885
|
-
for (let
|
|
1886
|
-
this._dists[
|
|
1925
|
+
let b = t[2 * w], g = t[2 * w + 1];
|
|
1926
|
+
if (p === 1 / 0) {
|
|
1927
|
+
for (let N = 0; N < s; N++)
|
|
1928
|
+
this._dists[N] = t[2 * N] - t[0] || t[2 * N + 1] - t[1];
|
|
1887
1929
|
Kt(this._ids, this._dists, 0, s - 1);
|
|
1888
|
-
const
|
|
1889
|
-
let
|
|
1890
|
-
for (let
|
|
1891
|
-
const
|
|
1892
|
-
y >
|
|
1930
|
+
const k = new Uint32Array(s);
|
|
1931
|
+
let P = 0;
|
|
1932
|
+
for (let N = 0, C = -1 / 0; N < s; N++) {
|
|
1933
|
+
const F = this._ids[N], y = this._dists[F];
|
|
1934
|
+
y > C && (k[P++] = F, C = y);
|
|
1893
1935
|
}
|
|
1894
|
-
this.hull =
|
|
1936
|
+
this.hull = k.subarray(0, P), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
|
|
1895
1937
|
return;
|
|
1896
1938
|
}
|
|
1897
|
-
if (
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1939
|
+
if (Ot(O, M, m, v, b, g) < 0) {
|
|
1940
|
+
const k = _, P = m, N = v;
|
|
1941
|
+
_ = w, m = b, v = g, w = k, b = P, g = N;
|
|
1900
1942
|
}
|
|
1901
|
-
const
|
|
1902
|
-
this._cx =
|
|
1903
|
-
for (let
|
|
1904
|
-
this._dists[
|
|
1905
|
-
Kt(this._ids, this._dists, 0, s - 1), this._hullStart =
|
|
1943
|
+
const E = Mr(O, M, m, v, b, g);
|
|
1944
|
+
this._cx = E.x, this._cy = E.y;
|
|
1945
|
+
for (let k = 0; k < s; k++)
|
|
1946
|
+
this._dists[k] = Ve(t[2 * k], t[2 * k + 1], E.x, E.y);
|
|
1947
|
+
Kt(this._ids, this._dists, 0, s - 1), this._hullStart = d;
|
|
1906
1948
|
let S = 3;
|
|
1907
|
-
i[
|
|
1908
|
-
for (let
|
|
1909
|
-
const
|
|
1910
|
-
if (
|
|
1911
|
-
let
|
|
1912
|
-
for (let
|
|
1949
|
+
i[d] = n[w] = _, i[_] = n[d] = w, i[w] = n[_] = d, o[d] = 0, o[_] = 1, o[w] = 2, r.fill(-1), r[this._hashKey(O, M)] = d, r[this._hashKey(m, v)] = _, r[this._hashKey(b, g)] = w, this.trianglesLen = 0, this._addTriangle(d, _, w, -1, -1, -1);
|
|
1950
|
+
for (let k = 0, P = 0, N = 0; k < this._ids.length; k++) {
|
|
1951
|
+
const C = this._ids[k], F = t[2 * C], y = t[2 * C + 1];
|
|
1952
|
+
if (k > 0 && Math.abs(F - P) <= En && Math.abs(y - N) <= En || (P = F, N = y, C === d || C === _ || C === w)) continue;
|
|
1953
|
+
let I = 0;
|
|
1954
|
+
for (let x = 0, B = this._hashKey(F, y); x < this._hashSize && (I = r[(B + x) % this._hashSize], !(I !== -1 && I !== i[I])); x++)
|
|
1913
1955
|
;
|
|
1914
|
-
|
|
1915
|
-
let
|
|
1916
|
-
for (; T = i[
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
1956
|
+
I = n[I];
|
|
1957
|
+
let A = I, T;
|
|
1958
|
+
for (; T = i[A], Ot(F, y, t[2 * A], t[2 * A + 1], t[2 * T], t[2 * T + 1]) >= 0; )
|
|
1959
|
+
if (A = T, A === I) {
|
|
1960
|
+
A = -1;
|
|
1919
1961
|
break;
|
|
1920
1962
|
}
|
|
1921
|
-
if (
|
|
1922
|
-
let
|
|
1923
|
-
o[
|
|
1924
|
-
let
|
|
1925
|
-
for (; T = i[
|
|
1926
|
-
|
|
1927
|
-
if (
|
|
1928
|
-
for (; T = n[
|
|
1929
|
-
|
|
1930
|
-
this._hullStart = n[
|
|
1963
|
+
if (A === -1) continue;
|
|
1964
|
+
let X = this._addTriangle(A, C, i[A], -1, -1, o[A]);
|
|
1965
|
+
o[C] = this._legalize(X + 2), o[A] = X, S++;
|
|
1966
|
+
let D = i[A];
|
|
1967
|
+
for (; T = i[D], Ot(F, y, t[2 * D], t[2 * D + 1], t[2 * T], t[2 * T + 1]) < 0; )
|
|
1968
|
+
X = this._addTriangle(D, C, T, o[C], -1, o[D]), o[C] = this._legalize(X + 2), i[D] = D, S--, D = T;
|
|
1969
|
+
if (A === I)
|
|
1970
|
+
for (; T = n[A], Ot(F, y, t[2 * T], t[2 * T + 1], t[2 * A], t[2 * A + 1]) < 0; )
|
|
1971
|
+
X = this._addTriangle(T, C, A, -1, o[A], o[T]), this._legalize(X + 2), o[T] = X, i[A] = A, S--, A = T;
|
|
1972
|
+
this._hullStart = n[C] = A, i[A] = n[D] = C, i[C] = D, r[this._hashKey(F, y)] = C, r[this._hashKey(t[2 * A], t[2 * A + 1])] = A;
|
|
1931
1973
|
}
|
|
1932
1974
|
this.hull = new Uint32Array(S);
|
|
1933
|
-
for (let
|
|
1934
|
-
this.hull[
|
|
1975
|
+
for (let k = 0, P = this._hullStart; k < S; k++)
|
|
1976
|
+
this.hull[k] = P, P = i[P];
|
|
1935
1977
|
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
1936
1978
|
}
|
|
1937
1979
|
/**
|
|
@@ -1942,7 +1984,7 @@ class Je {
|
|
|
1942
1984
|
* @private
|
|
1943
1985
|
*/
|
|
1944
1986
|
_hashKey(t, n) {
|
|
1945
|
-
return Math.floor(
|
|
1987
|
+
return Math.floor(br(t - this._cx, n - this._cy) * this._hashSize) % this._hashSize;
|
|
1946
1988
|
}
|
|
1947
1989
|
/**
|
|
1948
1990
|
* Flip an edge in a pair of triangles if it doesn't satisfy the Delaunay condition.
|
|
@@ -1954,37 +1996,37 @@ class Je {
|
|
|
1954
1996
|
const { _triangles: n, _halfedges: i, coords: o } = this;
|
|
1955
1997
|
let r = 0, s = 0;
|
|
1956
1998
|
for (; ; ) {
|
|
1957
|
-
const a = i[t],
|
|
1958
|
-
if (s =
|
|
1999
|
+
const a = i[t], l = t - t % 3;
|
|
2000
|
+
if (s = l + (t + 2) % 3, a === -1) {
|
|
1959
2001
|
if (r === 0) break;
|
|
1960
2002
|
t = ve[--r];
|
|
1961
2003
|
continue;
|
|
1962
2004
|
}
|
|
1963
|
-
const
|
|
1964
|
-
if (
|
|
1965
|
-
o[2 *
|
|
1966
|
-
o[2 *
|
|
1967
|
-
o[2 *
|
|
1968
|
-
o[2 *
|
|
1969
|
-
o[2 *
|
|
1970
|
-
o[2 *
|
|
2005
|
+
const f = a - a % 3, h = l + (t + 1) % 3, c = f + (a + 2) % 3, u = n[s], d = n[t], _ = n[h], w = n[c];
|
|
2006
|
+
if (xr(
|
|
2007
|
+
o[2 * u],
|
|
2008
|
+
o[2 * u + 1],
|
|
2009
|
+
o[2 * d],
|
|
2010
|
+
o[2 * d + 1],
|
|
2011
|
+
o[2 * _],
|
|
2012
|
+
o[2 * _ + 1],
|
|
1971
2013
|
o[2 * w],
|
|
1972
2014
|
o[2 * w + 1]
|
|
1973
2015
|
)) {
|
|
1974
|
-
n[t] = w, n[a] =
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
1977
|
-
let
|
|
2016
|
+
n[t] = w, n[a] = u;
|
|
2017
|
+
const M = i[c];
|
|
2018
|
+
if (M === -1) {
|
|
2019
|
+
let v = this._hullStart;
|
|
1978
2020
|
do {
|
|
1979
|
-
if (this._hullTri[
|
|
1980
|
-
this._hullTri[
|
|
2021
|
+
if (this._hullTri[v] === c) {
|
|
2022
|
+
this._hullTri[v] = t;
|
|
1981
2023
|
break;
|
|
1982
2024
|
}
|
|
1983
|
-
|
|
1984
|
-
} while (
|
|
2025
|
+
v = this._hullPrev[v];
|
|
2026
|
+
} while (v !== this._hullStart);
|
|
1985
2027
|
}
|
|
1986
|
-
this._link(t,
|
|
1987
|
-
const m =
|
|
2028
|
+
this._link(t, M), this._link(a, i[s]), this._link(s, c);
|
|
2029
|
+
const m = f + (a + 1) % 3;
|
|
1988
2030
|
r < ve.length && (ve[r++] = m);
|
|
1989
2031
|
} else {
|
|
1990
2032
|
if (r === 0) break;
|
|
@@ -2018,7 +2060,7 @@ class Je {
|
|
|
2018
2060
|
return this._triangles[a] = t, this._triangles[a + 1] = n, this._triangles[a + 2] = i, this._link(a, o), this._link(a + 1, r), this._link(a + 2, s), this.trianglesLen += 3, a;
|
|
2019
2061
|
}
|
|
2020
2062
|
}
|
|
2021
|
-
function
|
|
2063
|
+
function br(e, t) {
|
|
2022
2064
|
const n = e / (Math.abs(e) + Math.abs(t));
|
|
2023
2065
|
return (t > 0 ? 3 - n : 1 + n) / 4;
|
|
2024
2066
|
}
|
|
@@ -2026,17 +2068,17 @@ function Ve(e, t, n, i) {
|
|
|
2026
2068
|
const o = e - n, r = t - i;
|
|
2027
2069
|
return o * o + r * r;
|
|
2028
2070
|
}
|
|
2029
|
-
function
|
|
2030
|
-
const
|
|
2031
|
-
return
|
|
2071
|
+
function xr(e, t, n, i, o, r, s, a) {
|
|
2072
|
+
const l = e - s, f = t - a, h = n - s, c = i - a, u = o - s, d = r - a, _ = l * l + f * f, w = h * h + c * c, O = u * u + d * d;
|
|
2073
|
+
return l * (c * O - w * d) - f * (h * O - w * u) + _ * (h * d - c * u) < 0;
|
|
2032
2074
|
}
|
|
2033
|
-
function
|
|
2034
|
-
const s = n - e, a = i - t,
|
|
2035
|
-
return
|
|
2075
|
+
function _r(e, t, n, i, o, r) {
|
|
2076
|
+
const s = n - e, a = i - t, l = o - e, f = r - t, h = s * s + a * a, c = l * l + f * f, u = 0.5 / (s * f - a * l), d = (f * h - a * c) * u, _ = (s * c - l * h) * u;
|
|
2077
|
+
return d * d + _ * _;
|
|
2036
2078
|
}
|
|
2037
|
-
function
|
|
2038
|
-
const s = n - e, a = i - t,
|
|
2039
|
-
return { x:
|
|
2079
|
+
function Mr(e, t, n, i, o, r) {
|
|
2080
|
+
const s = n - e, a = i - t, l = o - e, f = r - t, h = s * s + a * a, c = l * l + f * f, u = 0.5 / (s * f - a * l), d = e + (f * h - a * c) * u, _ = t + (s * c - l * h) * u;
|
|
2081
|
+
return { x: d, y: _ };
|
|
2040
2082
|
}
|
|
2041
2083
|
function Kt(e, t, n, i) {
|
|
2042
2084
|
if (i - n <= 20)
|
|
@@ -2050,14 +2092,14 @@ function Kt(e, t, n, i) {
|
|
|
2050
2092
|
const o = n + i >> 1;
|
|
2051
2093
|
let r = n + 1, s = i;
|
|
2052
2094
|
te(e, o, r), t[e[n]] > t[e[i]] && te(e, n, i), t[e[r]] > t[e[i]] && te(e, r, i), t[e[n]] > t[e[r]] && te(e, n, r);
|
|
2053
|
-
const a = e[r],
|
|
2095
|
+
const a = e[r], l = t[a];
|
|
2054
2096
|
for (; ; ) {
|
|
2055
2097
|
do
|
|
2056
2098
|
r++;
|
|
2057
|
-
while (t[e[r]] <
|
|
2099
|
+
while (t[e[r]] < l);
|
|
2058
2100
|
do
|
|
2059
2101
|
s--;
|
|
2060
|
-
while (t[e[s]] >
|
|
2102
|
+
while (t[e[s]] > l);
|
|
2061
2103
|
if (s < r) break;
|
|
2062
2104
|
te(e, r, s);
|
|
2063
2105
|
}
|
|
@@ -2068,13 +2110,13 @@ function te(e, t, n) {
|
|
|
2068
2110
|
const i = e[t];
|
|
2069
2111
|
e[t] = e[n], e[n] = i;
|
|
2070
2112
|
}
|
|
2071
|
-
function
|
|
2113
|
+
function Sr(e) {
|
|
2072
2114
|
return e[0];
|
|
2073
2115
|
}
|
|
2074
|
-
function
|
|
2116
|
+
function Er(e) {
|
|
2075
2117
|
return e[1];
|
|
2076
2118
|
}
|
|
2077
|
-
class
|
|
2119
|
+
class kr {
|
|
2078
2120
|
bs;
|
|
2079
2121
|
width;
|
|
2080
2122
|
constructor(t, n) {
|
|
@@ -2130,25 +2172,25 @@ class _r {
|
|
|
2130
2172
|
return this;
|
|
2131
2173
|
}
|
|
2132
2174
|
}
|
|
2133
|
-
class kn extends
|
|
2175
|
+
class kn extends kr {
|
|
2134
2176
|
constructor(t) {
|
|
2135
2177
|
super(8, new Uint8Array(Math.ceil(t / 8)).fill(0));
|
|
2136
2178
|
}
|
|
2137
2179
|
}
|
|
2138
|
-
function
|
|
2180
|
+
function jt(e) {
|
|
2139
2181
|
return e % 3 === 2 ? e - 2 : e + 1;
|
|
2140
2182
|
}
|
|
2141
|
-
function
|
|
2183
|
+
function Pt(e) {
|
|
2142
2184
|
return e % 3 === 0 ? e + 2 : e - 1;
|
|
2143
2185
|
}
|
|
2144
|
-
function
|
|
2145
|
-
const
|
|
2146
|
-
if (
|
|
2186
|
+
function An(e, t, n, i, o, r, s, a) {
|
|
2187
|
+
const l = Ot(e, t, o, r, s, a), f = Ot(n, i, o, r, s, a);
|
|
2188
|
+
if (l > 0 && f > 0 || l < 0 && f < 0)
|
|
2147
2189
|
return !1;
|
|
2148
|
-
const
|
|
2149
|
-
return
|
|
2190
|
+
const h = Ot(o, r, e, t, n, i), c = Ot(s, a, e, t, n, i);
|
|
2191
|
+
return h > 0 && c > 0 || h < 0 && c < 0 ? !1 : l === 0 && f === 0 && h === 0 && c === 0 ? !(Math.max(o, s) < Math.min(e, n) || Math.max(e, n) < Math.min(o, s) || Math.max(r, a) < Math.min(t, i) || Math.max(t, i) < Math.min(r, a)) : !0;
|
|
2150
2192
|
}
|
|
2151
|
-
class
|
|
2193
|
+
class Ar {
|
|
2152
2194
|
/**
|
|
2153
2195
|
* The triangulation object from Delaunator.
|
|
2154
2196
|
*/
|
|
@@ -2157,7 +2199,7 @@ class Mr {
|
|
|
2157
2199
|
this.del = t;
|
|
2158
2200
|
}
|
|
2159
2201
|
}
|
|
2160
|
-
class
|
|
2202
|
+
class Ir extends Ar {
|
|
2161
2203
|
vertMap;
|
|
2162
2204
|
flips;
|
|
2163
2205
|
consd;
|
|
@@ -2187,75 +2229,120 @@ class Sr extends Mr {
|
|
|
2187
2229
|
* Constrain the triangulation such that there is an edge between p1 and p2.
|
|
2188
2230
|
*/
|
|
2189
2231
|
constrainOne(t, n) {
|
|
2190
|
-
const { triangles: i, halfedges: o } = this.del
|
|
2191
|
-
|
|
2232
|
+
const { triangles: i, halfedges: o } = this.del;
|
|
2233
|
+
this.assertVertex(t, t, n), this.assertVertex(n, t, n), this.assertInTriangulation(t, t, n), this.assertInTriangulation(n, t, n);
|
|
2234
|
+
const r = this.vertMap[t], s = this.maxConstrainSteps();
|
|
2235
|
+
let a = 0, l = r;
|
|
2192
2236
|
do {
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2237
|
+
if (++a > s)
|
|
2238
|
+
throw new Error(
|
|
2239
|
+
`Constraining edge [${t}, ${n}] exceeded the iteration limit`
|
|
2240
|
+
);
|
|
2241
|
+
const c = i[l], u = jt(l);
|
|
2242
|
+
if (c === n)
|
|
2243
|
+
return this.protect(l);
|
|
2244
|
+
const d = Pt(l), _ = i[d];
|
|
2245
|
+
if (_ === n)
|
|
2198
2246
|
return this.protect(u), u;
|
|
2199
|
-
if (this.intersectSegments(t, n,
|
|
2200
|
-
|
|
2247
|
+
if (this.intersectSegments(t, n, _, c)) {
|
|
2248
|
+
l = d;
|
|
2201
2249
|
break;
|
|
2202
2250
|
}
|
|
2203
|
-
|
|
2204
|
-
} while (
|
|
2205
|
-
let
|
|
2206
|
-
for (;
|
|
2207
|
-
|
|
2208
|
-
|
|
2251
|
+
l = o[u];
|
|
2252
|
+
} while (l !== -1 && l !== r);
|
|
2253
|
+
let f = l, h = -1;
|
|
2254
|
+
for (; l !== -1; ) {
|
|
2255
|
+
if (++a > s)
|
|
2256
|
+
throw new Error(
|
|
2257
|
+
`Constraining edge [${t}, ${n}] exceeded the iteration limit`
|
|
2258
|
+
);
|
|
2259
|
+
const c = o[l], u = Pt(l), d = Pt(c), _ = jt(c);
|
|
2260
|
+
if (c === -1)
|
|
2209
2261
|
throw new Error("Constraining edge exited the hull");
|
|
2210
|
-
if (this.consd.has(
|
|
2262
|
+
if (this.consd.has(l))
|
|
2211
2263
|
throw new Error("Edge intersects already constrained edge");
|
|
2212
|
-
if (this.isCollinear(t, n, i[
|
|
2264
|
+
if (this.isCollinear(t, n, i[l]) || this.isCollinear(t, n, i[c]))
|
|
2213
2265
|
throw new Error("Constraining edge intersects point");
|
|
2214
2266
|
if (!this.intersectSegments(
|
|
2215
|
-
i[s],
|
|
2216
2267
|
i[l],
|
|
2268
|
+
i[c],
|
|
2217
2269
|
i[u],
|
|
2218
|
-
i[
|
|
2270
|
+
i[d]
|
|
2219
2271
|
)) {
|
|
2220
|
-
if (h === -1 && (h =
|
|
2221
|
-
if (
|
|
2272
|
+
if (h === -1 && (h = l), i[d] === n) {
|
|
2273
|
+
if (l === h)
|
|
2222
2274
|
throw new Error("Infinite loop: non-convex quadrilateral");
|
|
2223
|
-
|
|
2275
|
+
l = h, h = -1;
|
|
2224
2276
|
continue;
|
|
2225
2277
|
}
|
|
2226
2278
|
if (this.intersectSegments(
|
|
2227
2279
|
t,
|
|
2228
2280
|
n,
|
|
2229
|
-
i[
|
|
2230
|
-
i[
|
|
2281
|
+
i[d],
|
|
2282
|
+
i[c]
|
|
2231
2283
|
))
|
|
2232
|
-
|
|
2284
|
+
l = d;
|
|
2233
2285
|
else if (this.intersectSegments(
|
|
2234
2286
|
t,
|
|
2235
2287
|
n,
|
|
2236
|
-
i[
|
|
2237
|
-
i[
|
|
2288
|
+
i[_],
|
|
2289
|
+
i[d]
|
|
2238
2290
|
))
|
|
2239
|
-
|
|
2240
|
-
else if (h ===
|
|
2291
|
+
l = _;
|
|
2292
|
+
else if (h === l)
|
|
2241
2293
|
throw new Error("Infinite loop: no further intersect after non-convex");
|
|
2242
2294
|
continue;
|
|
2243
2295
|
}
|
|
2244
|
-
if (this.flipDiagonal(
|
|
2296
|
+
if (this.flipDiagonal(l), this.intersectSegments(
|
|
2245
2297
|
t,
|
|
2246
2298
|
n,
|
|
2247
2299
|
i[u],
|
|
2248
|
-
i[
|
|
2300
|
+
i[d]
|
|
2249
2301
|
) && (h === -1 && (h = u), h === u))
|
|
2250
2302
|
throw new Error("Infinite loop: flipped diagonal still intersects");
|
|
2251
|
-
i[
|
|
2303
|
+
i[d] === n ? (f = d, l = h, h = -1) : this.intersectSegments(
|
|
2252
2304
|
t,
|
|
2253
2305
|
n,
|
|
2254
|
-
i[
|
|
2255
|
-
i[
|
|
2256
|
-
) && (
|
|
2306
|
+
i[_],
|
|
2307
|
+
i[d]
|
|
2308
|
+
) && (l = _);
|
|
2257
2309
|
}
|
|
2258
|
-
return this.protect(
|
|
2310
|
+
return this.protect(f), this.delaunify(!0), this.findEdge(t, n);
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Upper bound for the number of steps taken while constraining one edge.
|
|
2314
|
+
*
|
|
2315
|
+
* A constraint that crosses k edges is resolved in passes over the crossed
|
|
2316
|
+
* edges, so the number of steps can grow with k squared (for example when
|
|
2317
|
+
* the crossed edges fan out between two bowed rows of points). k is less
|
|
2318
|
+
* than the number of half-edges, so the square of that number is never
|
|
2319
|
+
* reached by a walk that terminates. The floor keeps tiny meshes away from
|
|
2320
|
+
* the limit.
|
|
2321
|
+
*/
|
|
2322
|
+
maxConstrainSteps() {
|
|
2323
|
+
const t = this.del.triangles.length;
|
|
2324
|
+
return Math.max(t * t, 4096);
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Throw unless `vertex` is part of the triangulation. Delaunator leaves out
|
|
2328
|
+
* points that coincide with another point, so a valid point id may have no
|
|
2329
|
+
* triangle. An edge cannot start or end at such a point.
|
|
2330
|
+
*/
|
|
2331
|
+
assertInTriangulation(t, n, i) {
|
|
2332
|
+
if (this.vertMap[t] >= this.del.triangles.length)
|
|
2333
|
+
throw new Error(
|
|
2334
|
+
`Invalid edge [${n}, ${i}]: vertex ${t} is not part of the triangulation`
|
|
2335
|
+
);
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Throw unless `vertex` is an id of a point given to Delaunator.
|
|
2339
|
+
*/
|
|
2340
|
+
assertVertex(t, n, i) {
|
|
2341
|
+
const o = this.vertMap.length;
|
|
2342
|
+
if (!Number.isInteger(t) || t < 0 || t >= o)
|
|
2343
|
+
throw new Error(
|
|
2344
|
+
`Invalid edge [${String(n)}, ${String(i)}]: vertex ids must be integers from 0 to ${o - 1}`
|
|
2345
|
+
);
|
|
2259
2346
|
}
|
|
2260
2347
|
/**
|
|
2261
2348
|
* Fix the Delaunay condition.
|
|
@@ -2269,8 +2356,8 @@ class Sr extends Mr {
|
|
|
2269
2356
|
if (o.has(a))
|
|
2270
2357
|
continue;
|
|
2271
2358
|
i.delete(a);
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2359
|
+
const l = n[a];
|
|
2360
|
+
l !== -1 && (i.delete(l), this.isDelaunay(a) || (this.flipDiagonal(a), s++));
|
|
2274
2361
|
}
|
|
2275
2362
|
} while (t && s > 0);
|
|
2276
2363
|
return this;
|
|
@@ -2298,13 +2385,19 @@ class Sr extends Mr {
|
|
|
2298
2385
|
*/
|
|
2299
2386
|
findEdge(t, n) {
|
|
2300
2387
|
const i = this.vertMap[n], { triangles: o, halfedges: r } = this.del;
|
|
2301
|
-
|
|
2388
|
+
if (!(i < o.length))
|
|
2389
|
+
return 1 / 0;
|
|
2390
|
+
let s = i, a, l = 0;
|
|
2302
2391
|
do {
|
|
2392
|
+
if (++l > o.length)
|
|
2393
|
+
throw new Error(
|
|
2394
|
+
`Looking up edge [${t}, ${n}] exceeded the iteration limit`
|
|
2395
|
+
);
|
|
2303
2396
|
if (o[s] === t)
|
|
2304
2397
|
return s;
|
|
2305
|
-
a =
|
|
2398
|
+
a = jt(s), s = r[a];
|
|
2306
2399
|
} while (s !== -1 && s !== i);
|
|
2307
|
-
return o[
|
|
2400
|
+
return o[jt(a)] === t ? -a : 1 / 0;
|
|
2308
2401
|
}
|
|
2309
2402
|
/**
|
|
2310
2403
|
* Mark an edge as constrained, i.e. should not be touched by `delaunify`.
|
|
@@ -2327,17 +2420,17 @@ class Sr extends Mr {
|
|
|
2327
2420
|
* Flip the edge shared by two triangles.
|
|
2328
2421
|
*/
|
|
2329
2422
|
flipDiagonal(t) {
|
|
2330
|
-
const { triangles: n, halfedges: i } = this.del, o = this.flips, r = this.consd, s = i[t], a =
|
|
2423
|
+
const { triangles: n, halfedges: i } = this.del, o = this.flips, r = this.consd, s = i[t], a = Pt(t), l = jt(t), f = Pt(s), h = jt(s), c = i[a], u = i[f];
|
|
2331
2424
|
if (r.has(t))
|
|
2332
2425
|
throw new Error("Trying to flip a constrained edge");
|
|
2333
|
-
return n[t] = n[
|
|
2426
|
+
return n[t] = n[f], i[t] = u, o.set(t, o.has(f)) || r.set(t, r.has(f)), u !== -1 && (i[u] = t), i[a] = f, n[s] = n[a], i[s] = c, o.set(s, o.has(a)) || r.set(s, r.has(a)), c !== -1 && (i[c] = s), i[f] = a, this.markFlip(t), this.markFlip(l), this.markFlip(s), this.markFlip(h), o.add(a), r.delete(a), o.add(f), r.delete(f), this.updateVert(t), this.updateVert(l), this.updateVert(s), this.updateVert(h), a;
|
|
2334
2427
|
}
|
|
2335
2428
|
/**
|
|
2336
2429
|
* Whether point p1, p2, and p are collinear.
|
|
2337
2430
|
*/
|
|
2338
2431
|
isCollinear(t, n, i) {
|
|
2339
2432
|
const o = this.del.coords;
|
|
2340
|
-
return
|
|
2433
|
+
return Ot(
|
|
2341
2434
|
o[t * 2],
|
|
2342
2435
|
o[t * 2 + 1],
|
|
2343
2436
|
o[n * 2],
|
|
@@ -2351,7 +2444,7 @@ class Sr extends Mr {
|
|
|
2351
2444
|
*/
|
|
2352
2445
|
inCircle(t, n, i, o) {
|
|
2353
2446
|
const r = this.del.coords;
|
|
2354
|
-
return
|
|
2447
|
+
return mi(
|
|
2355
2448
|
r[t * 2],
|
|
2356
2449
|
r[t * 2 + 1],
|
|
2357
2450
|
r[n * 2],
|
|
@@ -2369,17 +2462,17 @@ class Sr extends Mr {
|
|
|
2369
2462
|
const { triangles: n, halfedges: i } = this.del, o = i[t];
|
|
2370
2463
|
if (o === -1)
|
|
2371
2464
|
return !0;
|
|
2372
|
-
const r = n[
|
|
2373
|
-
return !this.inCircle(r, s, a,
|
|
2465
|
+
const r = n[Pt(t)], s = n[t], a = n[jt(t)], l = n[Pt(o)];
|
|
2466
|
+
return !this.inCircle(r, s, a, l);
|
|
2374
2467
|
}
|
|
2375
2468
|
/**
|
|
2376
2469
|
* Update the vertex -> incoming edge map.
|
|
2377
2470
|
*/
|
|
2378
2471
|
updateVert(t) {
|
|
2379
2472
|
const { triangles: n, halfedges: i } = this.del, o = this.vertMap, r = n[t];
|
|
2380
|
-
let s =
|
|
2473
|
+
let s = Pt(t), a = i[s];
|
|
2381
2474
|
for (; a !== -1 && a !== t; )
|
|
2382
|
-
s =
|
|
2475
|
+
s = Pt(a), a = i[s];
|
|
2383
2476
|
return o[r] = s, s;
|
|
2384
2477
|
}
|
|
2385
2478
|
/**
|
|
@@ -2387,7 +2480,7 @@ class Sr extends Mr {
|
|
|
2387
2480
|
*/
|
|
2388
2481
|
intersectSegments(t, n, i, o) {
|
|
2389
2482
|
const r = this.del.coords;
|
|
2390
|
-
return t === i || t === o || n === i || n === o ? !1 :
|
|
2483
|
+
return t === i || t === o || n === i || n === o ? !1 : An(
|
|
2391
2484
|
r[t * 2],
|
|
2392
2485
|
r[t * 2 + 1],
|
|
2393
2486
|
r[n * 2],
|
|
@@ -2398,65 +2491,65 @@ class Sr extends Mr {
|
|
|
2398
2491
|
r[o * 2 + 1]
|
|
2399
2492
|
);
|
|
2400
2493
|
}
|
|
2401
|
-
static intersectSegments =
|
|
2494
|
+
static intersectSegments = An;
|
|
2402
2495
|
}
|
|
2403
2496
|
function be(e, t, n) {
|
|
2404
2497
|
if (t || (t = []), typeof e != "object" || e.type !== "FeatureCollection")
|
|
2405
2498
|
throw "Argument points must be FeatureCollection";
|
|
2406
2499
|
if (!Array.isArray(t)) throw "Argument points must be Array of Array";
|
|
2407
2500
|
const i = e.features.map(
|
|
2408
|
-
(
|
|
2409
|
-
), o =
|
|
2501
|
+
(l) => l.geometry.coordinates
|
|
2502
|
+
), o = Ge.from(i);
|
|
2410
2503
|
let r;
|
|
2411
2504
|
const s = [];
|
|
2412
|
-
o.triangles.length !== 0 && t.length !== 0 && (r = new
|
|
2413
|
-
for (let
|
|
2414
|
-
s.push([o.triangles[
|
|
2505
|
+
o.triangles.length !== 0 && t.length !== 0 && (r = new Ir(o), r.constrainAll(t));
|
|
2506
|
+
for (let l = 0; l < o.triangles.length; l += 3)
|
|
2507
|
+
s.push([o.triangles[l], o.triangles[l + 1], o.triangles[l + 2]]);
|
|
2415
2508
|
const a = ["a", "b", "c"];
|
|
2416
|
-
return
|
|
2417
|
-
s.map((
|
|
2418
|
-
const
|
|
2419
|
-
const
|
|
2420
|
-
return
|
|
2509
|
+
return Et(
|
|
2510
|
+
s.map((l) => {
|
|
2511
|
+
const f = {}, h = l.map((c, u) => {
|
|
2512
|
+
const d = e.features[c], _ = d.geometry.coordinates, w = [_[0], _[1]];
|
|
2513
|
+
return _.length === 3 ? w[2] = _[2] : f[a[u]] = d.properties[n], w;
|
|
2421
2514
|
});
|
|
2422
|
-
return
|
|
2515
|
+
return h[3] = h[0], le([h], f);
|
|
2423
2516
|
})
|
|
2424
2517
|
);
|
|
2425
2518
|
}
|
|
2426
|
-
function
|
|
2519
|
+
function Or(e, t) {
|
|
2427
2520
|
const n = [[], [], [], []], i = [];
|
|
2428
2521
|
return Object.keys(e).forEach((o) => {
|
|
2429
|
-
const r = e[o], s = r.forw, a = r.bakw,
|
|
2522
|
+
const r = e[o], s = r.forw, a = r.bakw, l = [
|
|
2430
2523
|
s[0] - t.forw[0],
|
|
2431
2524
|
s[1] - t.forw[1]
|
|
2432
|
-
],
|
|
2525
|
+
], f = [
|
|
2433
2526
|
a[0] - t.bakw[0],
|
|
2434
2527
|
t.bakw[1] - a[1]
|
|
2435
|
-
],
|
|
2436
|
-
if (i.push(
|
|
2528
|
+
], h = { forw: l, bakw: f };
|
|
2529
|
+
if (i.push(h), l[0] === 0 || l[1] === 0)
|
|
2437
2530
|
return;
|
|
2438
2531
|
let c = 0;
|
|
2439
|
-
|
|
2532
|
+
l[0] > 0 && (c += 1), l[1] > 0 && (c += 2), n[c].push(h);
|
|
2440
2533
|
}), { perQuad: n, aggregate: i };
|
|
2441
2534
|
}
|
|
2442
|
-
function
|
|
2535
|
+
function Pr(e) {
|
|
2443
2536
|
let t = 1 / 0, n = 0, i = 0;
|
|
2444
2537
|
return e.forEach((o) => {
|
|
2445
|
-
const { forw: r, bakw: s } = o, a = Math.hypot(r[0], r[1]),
|
|
2446
|
-
if (
|
|
2447
|
-
const
|
|
2448
|
-
t = Math.min(t,
|
|
2538
|
+
const { forw: r, bakw: s } = o, a = Math.hypot(r[0], r[1]), l = Math.hypot(s[0], s[1]);
|
|
2539
|
+
if (l === 0) return;
|
|
2540
|
+
const f = a / l, h = Math.atan2(r[0], r[1]) - Math.atan2(s[0], s[1]);
|
|
2541
|
+
t = Math.min(t, f), n += Math.cos(h), i += Math.sin(h);
|
|
2449
2542
|
}), isFinite(t) ? [t, Math.atan2(i, n)] : [1, 0];
|
|
2450
2543
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const { perQuad: i, aggregate: o } =
|
|
2544
|
+
function Nr(e, t, n) {
|
|
2545
|
+
const { perQuad: i, aggregate: o } = Or(e, t), r = i.every((l) => l.length > 0), a = (n === "birdeye" ? r ? i : [o] : [o]).map((l) => Pr(l));
|
|
2453
2546
|
return a.length === 1 ? [a[0], a[0], a[0], a[0]] : a;
|
|
2454
2547
|
}
|
|
2455
|
-
function
|
|
2548
|
+
function Br(e, t) {
|
|
2456
2549
|
let n = 0;
|
|
2457
2550
|
return e[0] > t[0] && (n += 1), e[1] > t[1] && (n += 2), n;
|
|
2458
2551
|
}
|
|
2459
|
-
function
|
|
2552
|
+
function Tr(e, t, n) {
|
|
2460
2553
|
const i = [
|
|
2461
2554
|
e[0] - t.forw[0],
|
|
2462
2555
|
e[1] - t.forw[1]
|
|
@@ -2466,69 +2559,69 @@ function Pr(e, t, n) {
|
|
|
2466
2559
|
t.bakw[1] - r * Math.cos(s)
|
|
2467
2560
|
];
|
|
2468
2561
|
}
|
|
2469
|
-
function
|
|
2562
|
+
function Cr(e, t, n, i) {
|
|
2470
2563
|
const o = t[0] - e[0], r = t[1] - e[1];
|
|
2471
2564
|
if (Math.abs(o) < 1e-12 && Math.abs(r) < 1e-12) return null;
|
|
2472
|
-
const s = i[0] - n[0], a = i[1] - n[1],
|
|
2473
|
-
if (Math.abs(
|
|
2474
|
-
const c = (
|
|
2475
|
-
return c <= 1e-10 ||
|
|
2565
|
+
const s = i[0] - n[0], a = i[1] - n[1], l = n[0] - e[0], f = n[1] - e[1], h = o * a - r * s;
|
|
2566
|
+
if (Math.abs(h) < 1e-12) return null;
|
|
2567
|
+
const c = (l * a - f * s) / h, u = (l * r - f * o) / h;
|
|
2568
|
+
return c <= 1e-10 || u < -1e-10 || u > 1 + 1e-10 ? null : { t: c, point: [e[0] + c * o, e[1] + c * r] };
|
|
2476
2569
|
}
|
|
2477
|
-
function
|
|
2570
|
+
function Xr(e, t, n) {
|
|
2478
2571
|
const i = n.length;
|
|
2479
2572
|
let o = -1 / 0, r = null;
|
|
2480
2573
|
for (let s = 0; s < i; s++) {
|
|
2481
|
-
const a = (s + 1) % i,
|
|
2574
|
+
const a = (s + 1) % i, l = Cr(
|
|
2482
2575
|
e,
|
|
2483
2576
|
t,
|
|
2484
2577
|
n[s].bakw,
|
|
2485
2578
|
n[a].bakw
|
|
2486
2579
|
);
|
|
2487
|
-
|
|
2580
|
+
l && l.t > o && (o = l.t, r = l.point);
|
|
2488
2581
|
}
|
|
2489
2582
|
return r;
|
|
2490
2583
|
}
|
|
2491
|
-
function
|
|
2584
|
+
function In(e, t) {
|
|
2492
2585
|
const i = Math.atan2(e[0] - t[0], e[1] - t[1]) * (180 / Math.PI);
|
|
2493
2586
|
return i < 0 ? i + 360 : i;
|
|
2494
2587
|
}
|
|
2495
|
-
function
|
|
2588
|
+
function On(e, t, n, i, o, r) {
|
|
2496
2589
|
const s = t[0] - e[0], a = t[1] - e[1];
|
|
2497
2590
|
if (s === 0 && a === 0) return null;
|
|
2498
|
-
const
|
|
2591
|
+
const l = [];
|
|
2499
2592
|
if (s !== 0)
|
|
2500
|
-
for (const
|
|
2501
|
-
const c = (
|
|
2593
|
+
for (const h of [n, i]) {
|
|
2594
|
+
const c = (h - e[0]) / s;
|
|
2502
2595
|
if (c > 0) {
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2596
|
+
const u = e[1] + c * a;
|
|
2597
|
+
u >= o && u <= r && l.push({ t: c, x: h, y: u });
|
|
2505
2598
|
}
|
|
2506
2599
|
}
|
|
2507
2600
|
if (a !== 0)
|
|
2508
|
-
for (const
|
|
2509
|
-
const c = (
|
|
2601
|
+
for (const h of [o, r]) {
|
|
2602
|
+
const c = (h - e[1]) / a;
|
|
2510
2603
|
if (c > 0) {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2604
|
+
const u = e[0] + c * s;
|
|
2605
|
+
u >= n && u <= i && l.push({ t: c, x: u, y: h });
|
|
2513
2606
|
}
|
|
2514
2607
|
}
|
|
2515
|
-
if (
|
|
2516
|
-
|
|
2517
|
-
const
|
|
2518
|
-
return [
|
|
2608
|
+
if (l.length === 0) return null;
|
|
2609
|
+
l.sort((h, c) => h.t - c.t);
|
|
2610
|
+
const f = l[0];
|
|
2611
|
+
return [f.x, f.y];
|
|
2519
2612
|
}
|
|
2520
2613
|
function Pn(e, t, n) {
|
|
2521
2614
|
const i = e.length, o = new Array(i).fill(1);
|
|
2522
2615
|
for (const r of t)
|
|
2523
2616
|
for (let s = 0; s < i; s++) {
|
|
2524
|
-
const a = (s + 1) % i,
|
|
2525
|
-
if (
|
|
2526
|
-
const c =
|
|
2617
|
+
const a = (s + 1) % i, l = He([e[s].bakw, e[a].bakw]), f = He([n.bakw, r.bakw]), h = Bi(l, f);
|
|
2618
|
+
if (h.features.length > 0 && h.features[0].geometry) {
|
|
2619
|
+
const c = h.features[0], u = Math.sqrt(
|
|
2527
2620
|
Math.pow(r.bakw[0] - n.bakw[0], 2) + Math.pow(r.bakw[1] - n.bakw[1], 2)
|
|
2528
|
-
),
|
|
2621
|
+
), d = Math.sqrt(
|
|
2529
2622
|
Math.pow(c.geometry.coordinates[0] - n.bakw[0], 2) + Math.pow(c.geometry.coordinates[1] - n.bakw[1], 2)
|
|
2530
|
-
),
|
|
2531
|
-
|
|
2623
|
+
), _ = u / d;
|
|
2624
|
+
_ > o[s] && (o[s] = _), _ > o[a] && (o[a] = _);
|
|
2532
2625
|
}
|
|
2533
2626
|
}
|
|
2534
2627
|
e.forEach((r, s) => {
|
|
@@ -2539,114 +2632,114 @@ function Pn(e, t, n) {
|
|
|
2539
2632
|
];
|
|
2540
2633
|
});
|
|
2541
2634
|
}
|
|
2542
|
-
function
|
|
2543
|
-
const { convexBuf: i, centroid: o, allGcps: r, minx: s, maxx: a, miny:
|
|
2544
|
-
[s,
|
|
2545
|
-
[a, h],
|
|
2635
|
+
function Qn(e, t, n) {
|
|
2636
|
+
const { convexBuf: i, centroid: o, allGcps: r, minx: s, maxx: a, miny: l, maxy: f } = e, h = Nr(i, o, t), u = [
|
|
2637
|
+
[s, l],
|
|
2546
2638
|
[a, l],
|
|
2547
|
-
[
|
|
2639
|
+
[a, f],
|
|
2640
|
+
[s, f]
|
|
2548
2641
|
].map((g) => ({
|
|
2549
2642
|
forw: g,
|
|
2550
|
-
bakw:
|
|
2643
|
+
bakw: Tr(
|
|
2551
2644
|
g,
|
|
2552
2645
|
o,
|
|
2553
|
-
|
|
2646
|
+
h[Br(g, o.forw)]
|
|
2554
2647
|
)
|
|
2555
2648
|
}));
|
|
2556
|
-
if (
|
|
2557
|
-
(g,
|
|
2558
|
-
), Pn(
|
|
2559
|
-
const
|
|
2649
|
+
if (u.sort(
|
|
2650
|
+
(g, E) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1]) - Math.atan2(E.forw[0] - o.forw[0], E.forw[1] - o.forw[1])
|
|
2651
|
+
), Pn(u, r, o), !n) return u;
|
|
2652
|
+
const d = 4, _ = u.map(
|
|
2560
2653
|
(g) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1])
|
|
2561
|
-
), w =
|
|
2654
|
+
), w = u.map(
|
|
2562
2655
|
(g) => Math.atan2(
|
|
2563
2656
|
g.bakw[0] - o.bakw[0],
|
|
2564
2657
|
-(g.bakw[1] - o.bakw[1])
|
|
2565
2658
|
)
|
|
2566
2659
|
);
|
|
2567
|
-
function
|
|
2568
|
-
for (let
|
|
2569
|
-
const S = (
|
|
2570
|
-
let
|
|
2571
|
-
for (;
|
|
2572
|
-
for (;
|
|
2573
|
-
if (
|
|
2574
|
-
return { i:
|
|
2660
|
+
function O(g) {
|
|
2661
|
+
for (let E = 0; E < d; E++) {
|
|
2662
|
+
const S = (E + 1) % d, k = _[E], P = E < d - 1 ? _[S] : _[S] + 2 * Math.PI;
|
|
2663
|
+
let N = g;
|
|
2664
|
+
for (; N < k; ) N += 2 * Math.PI;
|
|
2665
|
+
for (; N >= k + 2 * Math.PI; ) N -= 2 * Math.PI;
|
|
2666
|
+
if (N >= k && N < P)
|
|
2667
|
+
return { i: E, j: S, frac: (N - k) / (P - k) };
|
|
2575
2668
|
}
|
|
2576
2669
|
return { i: 0, j: 1, frac: 0 };
|
|
2577
2670
|
}
|
|
2578
|
-
function
|
|
2579
|
-
const { i:
|
|
2580
|
-
let
|
|
2581
|
-
for (;
|
|
2582
|
-
for (;
|
|
2583
|
-
return
|
|
2671
|
+
function M(g) {
|
|
2672
|
+
const { i: E, j: S, frac: k } = O(g), P = w[E];
|
|
2673
|
+
let C = w[S] - P;
|
|
2674
|
+
for (; C > Math.PI; ) C -= 2 * Math.PI;
|
|
2675
|
+
for (; C < -Math.PI; ) C += 2 * Math.PI;
|
|
2676
|
+
return P + k * C;
|
|
2584
2677
|
}
|
|
2585
2678
|
const m = new Set(
|
|
2586
|
-
|
|
2587
|
-
(g) => Math.floor(
|
|
2679
|
+
u.map(
|
|
2680
|
+
(g) => Math.floor(In(g.forw, o.forw) / 10) % 36
|
|
2588
2681
|
)
|
|
2589
|
-
),
|
|
2682
|
+
), v = r.map((g) => ({
|
|
2590
2683
|
forw: g.forw,
|
|
2591
2684
|
bakw: g.bakw,
|
|
2592
|
-
angleDeg:
|
|
2685
|
+
angleDeg: In(g.forw, o.forw),
|
|
2593
2686
|
forwDist: Math.hypot(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1])
|
|
2594
|
-
})),
|
|
2687
|
+
})), p = [];
|
|
2595
2688
|
for (let g = 0; g < 36; g++) {
|
|
2596
2689
|
if (m.has(g)) continue;
|
|
2597
|
-
const
|
|
2598
|
-
(
|
|
2690
|
+
const E = g * 10, S = v.filter(
|
|
2691
|
+
(I) => I.angleDeg >= E && I.angleDeg < E + 10
|
|
2599
2692
|
);
|
|
2600
|
-
let
|
|
2693
|
+
let k = null;
|
|
2601
2694
|
if (S.length > 0) {
|
|
2602
|
-
const
|
|
2603
|
-
|
|
2695
|
+
const I = S.reduce((A, T) => T.forwDist > A.forwDist ? T : A);
|
|
2696
|
+
k = On(o.forw, I.forw, s, a, l, f);
|
|
2604
2697
|
}
|
|
2605
|
-
if (!
|
|
2606
|
-
const
|
|
2607
|
-
o.forw[0] + Math.sin(
|
|
2608
|
-
o.forw[1] + Math.cos(
|
|
2698
|
+
if (!k) {
|
|
2699
|
+
const I = (E + 5) % 360 * (Math.PI / 180), A = [
|
|
2700
|
+
o.forw[0] + Math.sin(I),
|
|
2701
|
+
o.forw[1] + Math.cos(I)
|
|
2609
2702
|
];
|
|
2610
|
-
|
|
2703
|
+
k = On(o.forw, A, s, a, l, f);
|
|
2611
2704
|
}
|
|
2612
|
-
if (!
|
|
2613
|
-
const
|
|
2614
|
-
o.bakw[0] + Math.sin(
|
|
2615
|
-
o.bakw[1] - Math.cos(
|
|
2616
|
-
], y =
|
|
2617
|
-
y &&
|
|
2618
|
-
}
|
|
2619
|
-
const
|
|
2620
|
-
return
|
|
2621
|
-
(g,
|
|
2622
|
-
), Pn(
|
|
2623
|
-
}
|
|
2624
|
-
function
|
|
2625
|
-
return
|
|
2626
|
-
}
|
|
2627
|
-
function
|
|
2628
|
-
return
|
|
2629
|
-
}
|
|
2630
|
-
function
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
(
|
|
2705
|
+
if (!k) continue;
|
|
2706
|
+
const P = [k[0] - o.forw[0], k[1] - o.forw[1]], N = Math.atan2(P[0], P[1]), C = M(N), F = [
|
|
2707
|
+
o.bakw[0] + Math.sin(C),
|
|
2708
|
+
o.bakw[1] - Math.cos(C)
|
|
2709
|
+
], y = Xr(o.bakw, F, u);
|
|
2710
|
+
y && p.push({ forw: k, bakw: y });
|
|
2711
|
+
}
|
|
2712
|
+
const b = [...u, ...p];
|
|
2713
|
+
return b.sort(
|
|
2714
|
+
(g, E) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1]) - Math.atan2(E.forw[0] - o.forw[0], E.forw[1] - o.forw[1])
|
|
2715
|
+
), Pn(b, r, o), b;
|
|
2716
|
+
}
|
|
2717
|
+
function $r(e, t = !1) {
|
|
2718
|
+
return Qn(e, "plain", t);
|
|
2719
|
+
}
|
|
2720
|
+
function Dr(e, t = !1) {
|
|
2721
|
+
return Qn(e, "birdeye", t);
|
|
2722
|
+
}
|
|
2723
|
+
function wo(e) {
|
|
2724
|
+
return Hn(e, 1 / 0);
|
|
2725
|
+
}
|
|
2726
|
+
const Nn = 1e5, Fr = 16;
|
|
2727
|
+
function Hn(e, t) {
|
|
2728
|
+
return Yr(e), new Rr(e).findSegmentIntersections(t).map(
|
|
2729
|
+
(o) => Rt([o.x, o.y])
|
|
2637
2730
|
);
|
|
2638
2731
|
}
|
|
2639
|
-
function
|
|
2732
|
+
function Yr(e) {
|
|
2640
2733
|
for (let t = 0, n = e.length; t < n; t++) {
|
|
2641
2734
|
const i = e[t];
|
|
2642
|
-
ae(i) ||
|
|
2735
|
+
ae(i) || qt(
|
|
2643
2736
|
"findIntersections() received invalid coordinates:",
|
|
2644
2737
|
`line=${t}`,
|
|
2645
2738
|
`points=${i}`
|
|
2646
2739
|
);
|
|
2647
2740
|
for (let o = 0, r = i.length; o < r; o++) {
|
|
2648
2741
|
const s = i[o];
|
|
2649
|
-
(!ae(s) || !Number.isFinite(s[0]) || !Number.isFinite(s[1])) &&
|
|
2742
|
+
(!ae(s) || !Number.isFinite(s[0]) || !Number.isFinite(s[1])) && qt(
|
|
2650
2743
|
"findIntersections() received non-finite coordinates:",
|
|
2651
2744
|
`line=${t}`,
|
|
2652
2745
|
`point=${o}`,
|
|
@@ -2655,7 +2748,7 @@ function Cr(e) {
|
|
|
2655
2748
|
}
|
|
2656
2749
|
}
|
|
2657
2750
|
}
|
|
2658
|
-
class
|
|
2751
|
+
class Rr {
|
|
2659
2752
|
/**
|
|
2660
2753
|
* 座標データの配列
|
|
2661
2754
|
* _xx, _yy: Float64Array形式で座標を保持
|
|
@@ -2700,7 +2793,7 @@ class Dr {
|
|
|
2700
2793
|
let r = 0;
|
|
2701
2794
|
for (let s = 0; s < o; s++)
|
|
2702
2795
|
this._ii[s] = r, r += t[s];
|
|
2703
|
-
(r != this._xx.length || this._xx.length != this._yy.length) &&
|
|
2796
|
+
(r != this._xx.length || this._xx.length != this._yy.length) && qt("ArcCollection#initXYData() Counting error"), this.initBounds(), this._arcIter = new so(this._xx, this._yy);
|
|
2704
2797
|
}
|
|
2705
2798
|
initBounds() {
|
|
2706
2799
|
const t = this.calcArcBounds_(this._xx, this._yy, this._nn);
|
|
@@ -2712,9 +2805,9 @@ class Dr {
|
|
|
2712
2805
|
*/
|
|
2713
2806
|
calcArcBounds_(t, n, i) {
|
|
2714
2807
|
const o = i.length, r = new Float64Array(o * 4), s = new ce();
|
|
2715
|
-
let a = 0,
|
|
2808
|
+
let a = 0, l, f, h;
|
|
2716
2809
|
for (let c = 0; c < o; c++)
|
|
2717
|
-
|
|
2810
|
+
l = i[c], l > 0 && (f = c * 4, h = ao(t, n, a, l), r[f++] = h[0], r[f++] = h[1], r[f++] = h[2], r[f] = h[3], a += l, s.mergeBounds(h));
|
|
2718
2811
|
return {
|
|
2719
2812
|
bb: r,
|
|
2720
2813
|
bounds: s
|
|
@@ -2736,10 +2829,10 @@ class Dr {
|
|
|
2736
2829
|
// @cb function(i, j, xx, yy)
|
|
2737
2830
|
forEachArcSegment(t, n) {
|
|
2738
2831
|
const i = t >= 0, o = i ? t : ~t, r = this.getRetainedInterval(), s = this._nn[o], a = i ? 1 : -1;
|
|
2739
|
-
let
|
|
2832
|
+
let l = i ? this._ii[o] : this._ii[o] + s - 1, f = l, h = 0;
|
|
2740
2833
|
for (let c = 1; c < s; c++)
|
|
2741
|
-
|
|
2742
|
-
return
|
|
2834
|
+
f += a, (r === 0 || this._zz[f] >= r) && (n(l, f, this._xx, this._yy), l = f, h++);
|
|
2835
|
+
return h;
|
|
2743
2836
|
}
|
|
2744
2837
|
getRetainedInterval() {
|
|
2745
2838
|
return this._zlimit;
|
|
@@ -2782,184 +2875,188 @@ class Dr {
|
|
|
2782
2875
|
* 線分の交差を検出
|
|
2783
2876
|
* ストライプ分割による効率的な判定を実装
|
|
2784
2877
|
*
|
|
2785
|
-
* @
|
|
2878
|
+
* @param limit - 返す交差点の件数の上限(同じ位置の交差は 1 件に数える)
|
|
2879
|
+
* @returns 検出された交差点の配列(同じ位置の重複なし)
|
|
2786
2880
|
*/
|
|
2787
|
-
findSegmentIntersections() {
|
|
2788
|
-
const
|
|
2789
|
-
let
|
|
2881
|
+
findSegmentIntersections(t = 1 / 0) {
|
|
2882
|
+
const n = this.getBounds(), i = n.ymin || 0, o = (n.ymax || 0) - i, r = this.calcSegmentIntersectionStripeCount(), s = new Uint32Array(r), a = r > 1 ? (v) => Math.floor((r - 1) * (v - i) / o) : () => 0, l = r + 1;
|
|
2883
|
+
let f;
|
|
2790
2884
|
this.forEachSegment(
|
|
2791
|
-
(
|
|
2792
|
-
let
|
|
2793
|
-
const
|
|
2794
|
-
let
|
|
2795
|
-
for (;
|
|
2796
|
-
|
|
2885
|
+
(v, p, b, g) => {
|
|
2886
|
+
let E = a(g[v]);
|
|
2887
|
+
const S = a(g[p]);
|
|
2888
|
+
let k = 0;
|
|
2889
|
+
for (; s[E] = s[E] + 2, E != S; )
|
|
2890
|
+
k++, k > l && qt(
|
|
2797
2891
|
"findSegmentIntersections() exceeded the stripe iteration limit:",
|
|
2798
|
-
`stripeCount=${
|
|
2799
|
-
`s1=${
|
|
2800
|
-
`s2=${
|
|
2801
|
-
),
|
|
2892
|
+
`stripeCount=${r}`,
|
|
2893
|
+
`s1=${E}`,
|
|
2894
|
+
`s2=${S}`
|
|
2895
|
+
), E += S > E ? 1 : -1;
|
|
2802
2896
|
}
|
|
2803
2897
|
);
|
|
2804
|
-
const
|
|
2898
|
+
const h = this.getUint32Array(Ur(s));
|
|
2805
2899
|
let c = 0;
|
|
2806
|
-
const
|
|
2807
|
-
|
|
2808
|
-
const
|
|
2809
|
-
c +=
|
|
2810
|
-
}),
|
|
2811
|
-
(
|
|
2812
|
-
let
|
|
2813
|
-
const
|
|
2814
|
-
let
|
|
2815
|
-
for (;
|
|
2816
|
-
|
|
2900
|
+
const u = [];
|
|
2901
|
+
jr(s, (v) => {
|
|
2902
|
+
const p = c;
|
|
2903
|
+
c += v, u.push(h.subarray(p, c));
|
|
2904
|
+
}), qr(s, 0), this.forEachSegment(
|
|
2905
|
+
(v, p, b, g) => {
|
|
2906
|
+
let E = a(g[v]);
|
|
2907
|
+
const S = a(g[p]);
|
|
2908
|
+
let k, P, N = 0;
|
|
2909
|
+
for (; k = s[E], s[E] = k + 2, P = u[E], P[k] = v, P[k + 1] = p, E != S; )
|
|
2910
|
+
N++, N > l && qt(
|
|
2817
2911
|
"findSegmentIntersections() exceeded the stripe iteration limit:",
|
|
2818
|
-
`stripeCount=${
|
|
2819
|
-
`s1=${
|
|
2820
|
-
`s2=${
|
|
2821
|
-
),
|
|
2912
|
+
`stripeCount=${r}`,
|
|
2913
|
+
`s1=${E}`,
|
|
2914
|
+
`s2=${S}`
|
|
2915
|
+
), E += S > E ? 1 : -1;
|
|
2822
2916
|
}
|
|
2823
2917
|
);
|
|
2824
|
-
const
|
|
2825
|
-
let w;
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2918
|
+
const d = this.getVertexData(), _ = t * Fr;
|
|
2919
|
+
let w = 0;
|
|
2920
|
+
const O = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), m = (v) => {
|
|
2921
|
+
w++;
|
|
2922
|
+
const p = oo(v);
|
|
2923
|
+
return O.has(p) || (O.add(p), M.set(`${v.x}:${v.y}`, v)), M.size >= t || w >= _;
|
|
2924
|
+
};
|
|
2925
|
+
if (d.xx && d.yy)
|
|
2926
|
+
for (f = 0; f < r && !zr(u[f], d.xx, d.yy, m); f++)
|
|
2927
|
+
;
|
|
2928
|
+
return Array.from(M.values());
|
|
2831
2929
|
}
|
|
2832
2930
|
}
|
|
2833
|
-
function
|
|
2931
|
+
function qt(...e) {
|
|
2834
2932
|
const t = e.join(" ");
|
|
2835
2933
|
throw new Error(t);
|
|
2836
2934
|
}
|
|
2837
2935
|
function ae(e) {
|
|
2838
|
-
return e ?
|
|
2936
|
+
return e ? Vr(e) ? !0 : Lr(e) ? !1 : e.length === 0 ? !0 : e.length > 0 : !1;
|
|
2839
2937
|
}
|
|
2840
|
-
function
|
|
2938
|
+
function Lr(e) {
|
|
2841
2939
|
return e != null && e.toString === String.prototype.toString;
|
|
2842
2940
|
}
|
|
2843
|
-
function
|
|
2941
|
+
function Vr(e) {
|
|
2844
2942
|
return Array.isArray(e);
|
|
2845
2943
|
}
|
|
2846
|
-
function
|
|
2847
|
-
ae(e) ||
|
|
2944
|
+
function Ur(e, t) {
|
|
2945
|
+
ae(e) || qt("utils.sum() expects an array, received:", e);
|
|
2848
2946
|
let n = 0, i;
|
|
2849
2947
|
for (let o = 0, r = e.length; o < r; o++)
|
|
2850
2948
|
i = e[o], i && (n += i);
|
|
2851
2949
|
return n;
|
|
2852
2950
|
}
|
|
2853
|
-
function
|
|
2951
|
+
function jr(e, t, n) {
|
|
2854
2952
|
if (!ae(e))
|
|
2855
2953
|
throw new Error(`#forEach() takes an array-like argument. ${e}`);
|
|
2856
2954
|
for (let i = 0, o = e.length; i < o; i++)
|
|
2857
2955
|
t.call(n, e[i], i);
|
|
2858
2956
|
}
|
|
2859
|
-
function
|
|
2957
|
+
function qr(e, t) {
|
|
2860
2958
|
for (let n = 0, i = e.length; n < i; n++)
|
|
2861
2959
|
e[n] = t;
|
|
2862
2960
|
return e;
|
|
2863
2961
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const
|
|
2866
|
-
let r, s, a,
|
|
2867
|
-
for (
|
|
2868
|
-
for (r = e[
|
|
2869
|
-
if (w = n[a],
|
|
2870
|
-
if (
|
|
2871
|
-
} else if (
|
|
2872
|
-
r == a || r ==
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2962
|
+
function zr(e, t, n, i) {
|
|
2963
|
+
const o = e.length - 2;
|
|
2964
|
+
let r, s, a, l, f, h, c, u, d, _, w, O, M, m, v, p, b;
|
|
2965
|
+
for (no(t, e), p = 0; p < o; ) {
|
|
2966
|
+
for (r = e[p], s = e[p + 1], f = t[r], h = t[s], d = n[r], _ = n[s], b = p; b < o && (b += 2, a = e[b], c = t[a], !(h < c)); ) {
|
|
2967
|
+
if (w = n[a], l = e[b + 1], u = t[l], O = n[l], d >= w) {
|
|
2968
|
+
if (d > O && _ > w && _ > O) continue;
|
|
2969
|
+
} else if (d < O && _ < w && _ < O) continue;
|
|
2970
|
+
if (!(r == a || r == l || s == a || s == l) && (M = Jr(
|
|
2971
|
+
f,
|
|
2972
|
+
d,
|
|
2973
|
+
h,
|
|
2974
|
+
_,
|
|
2877
2975
|
c,
|
|
2878
2976
|
w,
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
),
|
|
2882
|
-
|
|
2883
|
-
)));
|
|
2977
|
+
u,
|
|
2978
|
+
O
|
|
2979
|
+
), M && (m = [r, s], v = [a, l], i(Tn(M, m, v, t, n)) || M.length == 4 && i(Tn(M.slice(2), m, v, t, n)))))
|
|
2980
|
+
return !0;
|
|
2884
2981
|
}
|
|
2885
|
-
|
|
2982
|
+
p += 2;
|
|
2886
2983
|
}
|
|
2887
|
-
return
|
|
2984
|
+
return !1;
|
|
2888
2985
|
}
|
|
2889
|
-
function
|
|
2890
|
-
const
|
|
2891
|
-
let
|
|
2892
|
-
return
|
|
2986
|
+
function Jr(e, t, n, i, o, r, s, a) {
|
|
2987
|
+
const l = Gr(e, t, n, i, o, r, s, a);
|
|
2988
|
+
let f = null;
|
|
2989
|
+
return l && (f = Kr(e, t, n, i, o, r, s, a), f ? eo(e, t, n, i, o, r, s, a) && (f = null) : f = to(e, t, n, i, o, r, s, a)), f;
|
|
2893
2990
|
}
|
|
2894
|
-
function
|
|
2991
|
+
function Gr(e, t, n, i, o, r, s, a) {
|
|
2895
2992
|
return ie(e, t, n, i, o, r) * ie(e, t, n, i, s, a) <= 0 && ie(o, r, s, a, e, t) * ie(o, r, s, a, n, i) <= 0;
|
|
2896
2993
|
}
|
|
2897
2994
|
function ie(e, t, n, i, o, r) {
|
|
2898
|
-
return
|
|
2995
|
+
return Wn(e - o, t - r, n - o, i - r);
|
|
2899
2996
|
}
|
|
2900
|
-
function
|
|
2997
|
+
function Wn(e, t, n, i) {
|
|
2901
2998
|
return e * i - t * n;
|
|
2902
2999
|
}
|
|
2903
|
-
function
|
|
2904
|
-
let
|
|
2905
|
-
return
|
|
3000
|
+
function Kr(e, t, n, i, o, r, s, a) {
|
|
3001
|
+
let l = xe(e, t, n, i, o, r, s, a), f;
|
|
3002
|
+
return l && (f = Hr(l[0], l[1], e, t, n, i, o, r, s, a), f == 1 ? l = xe(n, i, e, t, o, r, s, a) : f == 2 ? l = xe(o, r, s, a, e, t, n, i) : f == 3 && (l = xe(s, a, o, r, e, t, n, i))), l && Zr(l, e, t, n, i, o, r, s, a), l;
|
|
2906
3003
|
}
|
|
2907
3004
|
function xe(e, t, n, i, o, r, s, a) {
|
|
2908
|
-
const
|
|
2909
|
-
let
|
|
2910
|
-
if (
|
|
2911
|
-
const c = ie(o, r, s, a, e, t) /
|
|
2912
|
-
return
|
|
3005
|
+
const l = Wn(n - e, i - t, s - o, a - r), f = 1e-18;
|
|
3006
|
+
let h;
|
|
3007
|
+
if (l === 0) return null;
|
|
3008
|
+
const c = ie(o, r, s, a, e, t) / l;
|
|
3009
|
+
return l <= f && l >= -f ? h = Qr(e, t, n, i, o, r, s, a) : h = [e + c * (n - e), t + c * (i - t)], h;
|
|
2913
3010
|
}
|
|
2914
|
-
function
|
|
2915
|
-
let
|
|
2916
|
-
return !
|
|
3011
|
+
function Qr(e, t, n, i, o, r, s, a) {
|
|
3012
|
+
let l = null;
|
|
3013
|
+
return !Nt(e, o, s) && !Nt(t, r, a) ? l = [e, t] : !Nt(n, o, s) && !Nt(i, r, a) ? l = [n, i] : !Nt(o, e, n) && !Nt(r, t, i) ? l = [o, r] : !Nt(s, e, n) && !Nt(a, t, i) && (l = [s, a]), l;
|
|
2917
3014
|
}
|
|
2918
|
-
function
|
|
3015
|
+
function Nt(e, t, n) {
|
|
2919
3016
|
let i;
|
|
2920
3017
|
return t < n ? i = e < t || e > n : t > n ? i = e > t || e < n : i = e != t, i;
|
|
2921
3018
|
}
|
|
2922
|
-
function
|
|
3019
|
+
function Hr(e, t, ...n) {
|
|
2923
3020
|
let i = -1, o = 1 / 0, r;
|
|
2924
|
-
for (let s = 0, a = 0,
|
|
2925
|
-
r =
|
|
3021
|
+
for (let s = 0, a = 0, l = n.length; a < l; s++, a += 2)
|
|
3022
|
+
r = Wr(e, t, n[a], n[a + 1]), r < o && (o = r, i = s);
|
|
2926
3023
|
return i;
|
|
2927
3024
|
}
|
|
2928
|
-
function
|
|
3025
|
+
function Wr(e, t, n, i) {
|
|
2929
3026
|
const o = e - n, r = t - i;
|
|
2930
3027
|
return o * o + r * r;
|
|
2931
3028
|
}
|
|
2932
|
-
function
|
|
2933
|
-
let
|
|
2934
|
-
|
|
3029
|
+
function Zr(e, t, n, i, o, r, s, a, l) {
|
|
3030
|
+
let f = e[0], h = e[1];
|
|
3031
|
+
f = _e(f, t, i), f = _e(f, r, a), h = _e(h, n, o), h = _e(h, s, l), e[0] = f, e[1] = h;
|
|
2935
3032
|
}
|
|
2936
3033
|
function _e(e, t, n) {
|
|
2937
3034
|
let i;
|
|
2938
|
-
return
|
|
3035
|
+
return Nt(e, t, n) && (i = Math.abs(e - t) < Math.abs(e - n) ? t : n, e = i), e;
|
|
2939
3036
|
}
|
|
2940
|
-
function
|
|
2941
|
-
const
|
|
2942
|
-
let
|
|
2943
|
-
return (
|
|
3037
|
+
function to(e, t, n, i, o, r, s, a) {
|
|
3038
|
+
const l = Math.min(e, n, o, s), f = Math.max(e, n, o, s), h = Math.min(t, i, r, a), c = Math.max(t, i, r, a), u = c - h > f - l;
|
|
3039
|
+
let d = [];
|
|
3040
|
+
return (u ? Yt(t, h, c) : Yt(e, l, f)) && d.push(e, t), (u ? Yt(i, h, c) : Yt(n, l, f)) && d.push(n, i), (u ? Yt(r, h, c) : Yt(o, l, f)) && d.push(o, r), (u ? Yt(a, h, c) : Yt(s, l, f)) && d.push(s, a), (d.length != 2 && d.length != 4 || d.length == 4 && d[0] == d[2] && d[1] == d[3]) && (d = null), d;
|
|
2944
3041
|
}
|
|
2945
|
-
function
|
|
3042
|
+
function eo(e, t, n, i, o, r, s, a) {
|
|
2946
3043
|
return e == o && t == r || e == s && t == a || n == o && i == r || n == s && i == a;
|
|
2947
3044
|
}
|
|
2948
|
-
function
|
|
3045
|
+
function Yt(e, t, n) {
|
|
2949
3046
|
return e > t && e < n;
|
|
2950
3047
|
}
|
|
2951
|
-
function
|
|
2952
|
-
|
|
3048
|
+
function no(e, t) {
|
|
3049
|
+
io(e, t), Zn(e, t, 0, t.length - 2);
|
|
2953
3050
|
}
|
|
2954
|
-
function
|
|
3051
|
+
function io(e, t) {
|
|
2955
3052
|
for (let n = 0, i = t.length; n < i; n += 2)
|
|
2956
|
-
e[t[n]] > e[t[n + 1]] &&
|
|
3053
|
+
e[t[n]] > e[t[n + 1]] && ro(t, n, n + 1);
|
|
2957
3054
|
}
|
|
2958
|
-
function
|
|
3055
|
+
function ro(e, t, n) {
|
|
2959
3056
|
const i = e[t];
|
|
2960
3057
|
e[t] = e[n], e[n] = i;
|
|
2961
3058
|
}
|
|
2962
|
-
function
|
|
3059
|
+
function Zn(e, t, n, i) {
|
|
2963
3060
|
let o = n, r = i, s, a;
|
|
2964
3061
|
for (; o < i; ) {
|
|
2965
3062
|
for (s = e[t[n + i >> 2 << 1]]; o <= r; ) {
|
|
@@ -2967,14 +3064,14 @@ function Kn(e, t, n, i) {
|
|
|
2967
3064
|
for (; e[t[r]] > s; ) r -= 2;
|
|
2968
3065
|
o <= r && (a = t[o], t[o] = t[r], t[r] = a, a = t[o + 1], t[o + 1] = t[r + 1], t[r + 1] = a, o += 2, r -= 2);
|
|
2969
3066
|
}
|
|
2970
|
-
if (r - n < 40 ?
|
|
2971
|
-
|
|
3067
|
+
if (r - n < 40 ? Bn(e, t, n, r) : Zn(e, t, n, r), i - o < 40) {
|
|
3068
|
+
Bn(e, t, o, i);
|
|
2972
3069
|
return;
|
|
2973
3070
|
}
|
|
2974
3071
|
n = o, r = i;
|
|
2975
3072
|
}
|
|
2976
3073
|
}
|
|
2977
|
-
function
|
|
3074
|
+
function Bn(e, t, n, i) {
|
|
2978
3075
|
let o, r;
|
|
2979
3076
|
for (let s = n + 2; s <= i; s += 2) {
|
|
2980
3077
|
o = t[s], r = t[s + 1];
|
|
@@ -2984,27 +3081,20 @@ function On(e, t, n, i) {
|
|
|
2984
3081
|
t[a + 2] = o, t[a + 3] = r;
|
|
2985
3082
|
}
|
|
2986
3083
|
}
|
|
2987
|
-
function
|
|
3084
|
+
function Tn(e, t, n, i, o) {
|
|
2988
3085
|
const r = e[0], s = e[1];
|
|
2989
|
-
t =
|
|
2990
|
-
const a = t[0] < n[0] ? t : n,
|
|
2991
|
-
return { x: r, y: s, a, b:
|
|
3086
|
+
t = Cn(r, s, t[0], t[1], i, o), n = Cn(r, s, n[0], n[1], i, o);
|
|
3087
|
+
const a = t[0] < n[0] ? t : n, l = a == t ? n : t;
|
|
3088
|
+
return { x: r, y: s, a, b: l };
|
|
2992
3089
|
}
|
|
2993
|
-
function
|
|
3090
|
+
function Cn(e, t, n, i, o, r) {
|
|
2994
3091
|
let s = n < i ? n : i, a = s === n ? i : n;
|
|
2995
3092
|
return o[s] == e && r[s] == t ? a = s : o[a] == e && r[a] == t && (s = a), [s, a];
|
|
2996
3093
|
}
|
|
2997
|
-
function
|
|
2998
|
-
const t = {};
|
|
2999
|
-
return e.filter((n) => {
|
|
3000
|
-
const i = eo(n);
|
|
3001
|
-
return i in t ? !1 : (t[i] = !0, !0);
|
|
3002
|
-
});
|
|
3003
|
-
}
|
|
3004
|
-
function eo(e) {
|
|
3094
|
+
function oo(e) {
|
|
3005
3095
|
return `${e.a.join(",")};${e.b.join(",")}`;
|
|
3006
3096
|
}
|
|
3007
|
-
class
|
|
3097
|
+
class so {
|
|
3008
3098
|
_i = 0;
|
|
3009
3099
|
_n = 0;
|
|
3010
3100
|
_inc = 1;
|
|
@@ -3017,16 +3107,16 @@ class no {
|
|
|
3017
3107
|
this._xx = t, this._yy = n;
|
|
3018
3108
|
}
|
|
3019
3109
|
}
|
|
3020
|
-
function
|
|
3110
|
+
function ao(e, t, n, i) {
|
|
3021
3111
|
let o = n | 0;
|
|
3022
3112
|
const r = isNaN(i) ? e.length - o : i + o;
|
|
3023
|
-
let s, a,
|
|
3113
|
+
let s, a, l, f, h, c;
|
|
3024
3114
|
if (r > 0)
|
|
3025
|
-
|
|
3115
|
+
l = h = e[o], f = c = t[o];
|
|
3026
3116
|
else return [void 0, void 0, void 0, void 0];
|
|
3027
3117
|
for (o++; o < r; o++)
|
|
3028
|
-
s = e[o], a = t[o], s <
|
|
3029
|
-
return [
|
|
3118
|
+
s = e[o], a = t[o], s < l && (l = s), s > h && (h = s), a < f && (f = a), a > c && (c = a);
|
|
3119
|
+
return [l, f, h, c];
|
|
3030
3120
|
}
|
|
3031
3121
|
class ce {
|
|
3032
3122
|
xmin;
|
|
@@ -3055,18 +3145,18 @@ class ce {
|
|
|
3055
3145
|
return this.ymax - this.ymin || 0;
|
|
3056
3146
|
}
|
|
3057
3147
|
setBounds(t, n, i, o) {
|
|
3058
|
-
let r, s, a,
|
|
3148
|
+
let r, s, a, l;
|
|
3059
3149
|
if (arguments.length == 1)
|
|
3060
3150
|
if (ae(t)) {
|
|
3061
|
-
const
|
|
3062
|
-
r =
|
|
3151
|
+
const f = t;
|
|
3152
|
+
r = f[0], s = f[1], a = f[2], l = f[3];
|
|
3063
3153
|
} else {
|
|
3064
|
-
const
|
|
3065
|
-
r =
|
|
3154
|
+
const f = t;
|
|
3155
|
+
r = f.xmin, s = f.ymin, a = f.xmax, l = f.ymax;
|
|
3066
3156
|
}
|
|
3067
3157
|
else
|
|
3068
|
-
r = t, s = n, a = i,
|
|
3069
|
-
return this.xmin = r, this.ymin = s, this.xmax = a, this.ymax =
|
|
3158
|
+
r = t, s = n, a = i, l = o;
|
|
3159
|
+
return this.xmin = r, this.ymin = s, this.xmax = a, this.ymax = l, (r > a || s > l) && this.update(), this;
|
|
3070
3160
|
}
|
|
3071
3161
|
update() {
|
|
3072
3162
|
let t;
|
|
@@ -3074,7 +3164,7 @@ class ce {
|
|
|
3074
3164
|
}
|
|
3075
3165
|
mergeBounds(t, ...n) {
|
|
3076
3166
|
let i, o, r, s;
|
|
3077
|
-
return t instanceof ce ? (i = t.xmin, o = t.ymin, r = t.xmax, s = t.ymax) : n.length == 3 ? (i = t, o = n[0], r = n[1], s = n[2]) : t.length == 4 ? (i = t[0], o = t[1], r = t[2], s = t[3]) :
|
|
3167
|
+
return t instanceof ce ? (i = t.xmin, o = t.ymin, r = t.xmax, s = t.ymax) : n.length == 3 ? (i = t, o = n[0], r = n[1], s = n[2]) : t.length == 4 ? (i = t[0], o = t[1], r = t[2], s = t[3]) : qt("Bounds#mergeBounds() invalid argument:", t), this.xmin === void 0 ? this.setBounds(i, o, r, s) : (i < this.xmin && (this.xmin = i), o < this.ymin && (this.ymin = o), r > this.xmax && (this.xmax = r), s > this.ymax && (this.ymax = s)), this;
|
|
3078
3168
|
}
|
|
3079
3169
|
}
|
|
3080
3170
|
function Ae(e) {
|
|
@@ -3090,7 +3180,7 @@ function Ae(e) {
|
|
|
3090
3180
|
(n) => n.map((i) => t[i]).sort().join("-")
|
|
3091
3181
|
).sort();
|
|
3092
3182
|
}
|
|
3093
|
-
function
|
|
3183
|
+
function ti(e, t, n) {
|
|
3094
3184
|
const i = Ae(t.forw), o = Ae(t.bakw);
|
|
3095
3185
|
if (JSON.stringify(i) != JSON.stringify(o))
|
|
3096
3186
|
throw `${JSON.stringify(t, null, 2)}
|
|
@@ -3104,7 +3194,7 @@ ${JSON.stringify(o)}`;
|
|
|
3104
3194
|
}
|
|
3105
3195
|
n && (n.forw.features.push(t.forw), n.bakw.features.push(t.bakw));
|
|
3106
3196
|
}
|
|
3107
|
-
function
|
|
3197
|
+
function Xn(e, t, n) {
|
|
3108
3198
|
const i = Ae(t.forw), o = Ae(t.bakw);
|
|
3109
3199
|
if (JSON.stringify(i) != JSON.stringify(o))
|
|
3110
3200
|
throw `${JSON.stringify(t, null, 2)}
|
|
@@ -3113,34 +3203,34 @@ ${JSON.stringify(o)}`;
|
|
|
3113
3203
|
if (i.forEach((r) => {
|
|
3114
3204
|
const s = e[r];
|
|
3115
3205
|
if (!s) return;
|
|
3116
|
-
const a = s.filter((
|
|
3206
|
+
const a = s.filter((l) => l !== t);
|
|
3117
3207
|
a.length === 0 ? delete e[r] : e[r] = a;
|
|
3118
3208
|
}), n) {
|
|
3119
3209
|
const r = (s, a) => {
|
|
3120
|
-
!s || !a || (s.features = s.features.filter((
|
|
3210
|
+
!s || !a || (s.features = s.features.filter((l) => l !== a));
|
|
3121
3211
|
};
|
|
3122
3212
|
r(n.forw, t.forw), r(n.bakw, t.bakw);
|
|
3123
3213
|
}
|
|
3124
3214
|
}
|
|
3125
3215
|
function Me(e, t, n) {
|
|
3126
|
-
return
|
|
3216
|
+
return Rt(e, { target: { geom: t, index: n } });
|
|
3127
3217
|
}
|
|
3128
3218
|
function Se(e) {
|
|
3129
|
-
return
|
|
3219
|
+
return Rt(e.properties.target.geom, {
|
|
3130
3220
|
target: {
|
|
3131
3221
|
geom: e.geometry.coordinates,
|
|
3132
3222
|
index: e.properties.target.index
|
|
3133
3223
|
}
|
|
3134
3224
|
});
|
|
3135
3225
|
}
|
|
3136
|
-
function
|
|
3226
|
+
function $n(e, t) {
|
|
3137
3227
|
const n = e.length, i = t.geometry.coordinates;
|
|
3138
3228
|
return Array.from({ length: n }, (o, r) => r).map((o) => {
|
|
3139
|
-
const r = (o + 1) % n, s = e[o], a = e[r],
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
),
|
|
3143
|
-
(
|
|
3229
|
+
const r = (o + 1) % n, s = e[o], a = e[r], l = s.geometry.coordinates, f = Math.atan2(
|
|
3230
|
+
l[0] - i[0],
|
|
3231
|
+
l[1] - i[1]
|
|
3232
|
+
), h = [t, s, a, t].map(
|
|
3233
|
+
(d) => d.geometry.coordinates
|
|
3144
3234
|
), c = {
|
|
3145
3235
|
a: {
|
|
3146
3236
|
geom: t.properties.target.geom,
|
|
@@ -3154,20 +3244,20 @@ function Xn(e, t) {
|
|
|
3154
3244
|
geom: a.properties.target.geom,
|
|
3155
3245
|
index: a.properties.target.index
|
|
3156
3246
|
}
|
|
3157
|
-
},
|
|
3158
|
-
le([
|
|
3247
|
+
}, u = Et([
|
|
3248
|
+
le([h], c)
|
|
3159
3249
|
]);
|
|
3160
|
-
return [
|
|
3250
|
+
return [f, u];
|
|
3161
3251
|
}).reduce(
|
|
3162
3252
|
(o, r) => (o[0].push(r[0]), o[1].push(r[1]), o),
|
|
3163
3253
|
[[], []]
|
|
3164
3254
|
);
|
|
3165
3255
|
}
|
|
3166
|
-
function
|
|
3256
|
+
function Ee(e, t = 1e-6) {
|
|
3167
3257
|
const [n, i] = e[0], [o, r] = e[1], [s, a] = e[2];
|
|
3168
3258
|
return Math.abs((o - n) * (a - i) - (s - n) * (r - i)) < t;
|
|
3169
3259
|
}
|
|
3170
|
-
function
|
|
3260
|
+
function co(e, t) {
|
|
3171
3261
|
const n = /* @__PURE__ */ new Set();
|
|
3172
3262
|
return e.forEach((i) => {
|
|
3173
3263
|
if (i.length !== 2) return;
|
|
@@ -3181,147 +3271,147 @@ function re(e) {
|
|
|
3181
3271
|
geom: e.geometry.coordinates[0][n]
|
|
3182
3272
|
}));
|
|
3183
3273
|
}
|
|
3184
|
-
const
|
|
3185
|
-
function
|
|
3274
|
+
const lo = 10;
|
|
3275
|
+
function fo(e, t, n, i, o, r) {
|
|
3186
3276
|
if (!e && !t) return !1;
|
|
3187
|
-
const s = e ? 0 : 1, a = 1 - s,
|
|
3188
|
-
if (!
|
|
3189
|
-
const
|
|
3190
|
-
let c = !1,
|
|
3191
|
-
for (let
|
|
3192
|
-
const
|
|
3193
|
-
if (!
|
|
3194
|
-
const w = [String(
|
|
3195
|
-
if (!
|
|
3196
|
-
const
|
|
3197
|
-
(
|
|
3277
|
+
const s = e ? 0 : 1, a = 1 - s, l = n[s], f = n[a];
|
|
3278
|
+
if (!l || !f) return !1;
|
|
3279
|
+
const h = _t(f.geom);
|
|
3280
|
+
let c = !1, u = !1;
|
|
3281
|
+
for (let d = 0; d <= 1; d++) {
|
|
3282
|
+
const _ = i[d];
|
|
3283
|
+
if (!_) continue;
|
|
3284
|
+
const w = [String(_.prop.index), String(l.prop.index)].sort().join("-"), O = o[w];
|
|
3285
|
+
if (!O || O.length < 2) continue;
|
|
3286
|
+
const M = O.find(
|
|
3287
|
+
(N) => N.bakw !== r[s].bakw
|
|
3198
3288
|
);
|
|
3199
|
-
if (!
|
|
3200
|
-
const
|
|
3201
|
-
(
|
|
3289
|
+
if (!M) continue;
|
|
3290
|
+
const v = re(M.bakw).find(
|
|
3291
|
+
(N) => String(N.prop.index) !== String(_.prop.index) && String(N.prop.index) !== String(l.prop.index)
|
|
3202
3292
|
);
|
|
3203
|
-
if (!
|
|
3293
|
+
if (!v) continue;
|
|
3204
3294
|
c = !0;
|
|
3205
|
-
const
|
|
3206
|
-
if (
|
|
3207
|
-
|
|
3295
|
+
const p = _t(v.geom), b = _t(_.geom), g = _t(l.geom), E = g[0] - b[0], S = g[1] - b[1], k = E * (h[1] - b[1]) - S * (h[0] - b[0]), P = E * (p[1] - b[1]) - S * (p[0] - b[0]);
|
|
3296
|
+
if (k * P > 0) {
|
|
3297
|
+
u = !0;
|
|
3208
3298
|
break;
|
|
3209
3299
|
}
|
|
3210
3300
|
}
|
|
3211
|
-
return c && !
|
|
3301
|
+
return c && !u;
|
|
3212
3302
|
}
|
|
3213
|
-
function
|
|
3303
|
+
function ho(e, t, n, i) {
|
|
3214
3304
|
if (!e && !t) return !1;
|
|
3215
3305
|
if (n[0] && n[1] && i[0] && i[1]) {
|
|
3216
|
-
const o = i.map((
|
|
3217
|
-
return
|
|
3306
|
+
const o = i.map((h) => _t(h.geom)), r = n.map((h) => _t(h.geom)), s = o[1][0] - o[0][0], a = o[1][1] - o[0][1], l = s * (r[0][1] - o[0][1]) - a * (r[0][0] - o[0][0]), f = s * (r[1][1] - o[0][1]) - a * (r[1][0] - o[0][0]);
|
|
3307
|
+
return l * f < 0;
|
|
3218
3308
|
}
|
|
3219
3309
|
return !1;
|
|
3220
3310
|
}
|
|
3221
|
-
function
|
|
3222
|
-
const o =
|
|
3311
|
+
function uo(e, t, n, i) {
|
|
3312
|
+
const o = co(n, i), r = /* @__PURE__ */ new Set();
|
|
3223
3313
|
let s = !1;
|
|
3224
|
-
for (let a = 0; a <
|
|
3225
|
-
let
|
|
3226
|
-
for (const
|
|
3227
|
-
if (r.has(
|
|
3228
|
-
r.add(
|
|
3229
|
-
const
|
|
3230
|
-
if (!
|
|
3231
|
-
const c =
|
|
3232
|
-
if (c.length !== 2 || o.has(
|
|
3233
|
-
const
|
|
3234
|
-
(
|
|
3235
|
-
),
|
|
3236
|
-
(
|
|
3314
|
+
for (let a = 0; a < lo; a++) {
|
|
3315
|
+
let l = !1;
|
|
3316
|
+
for (const f of Object.keys(t)) {
|
|
3317
|
+
if (r.has(f)) continue;
|
|
3318
|
+
r.add(f);
|
|
3319
|
+
const h = t[f];
|
|
3320
|
+
if (!h || h.length < 2) continue;
|
|
3321
|
+
const c = f.split("-");
|
|
3322
|
+
if (c.length !== 2 || o.has(f)) continue;
|
|
3323
|
+
const u = re(h[0].bakw), d = re(h[1].bakw), _ = re(h[0].forw), w = re(h[1].forw), O = c.map(
|
|
3324
|
+
(x) => u.find((B) => `${B.prop.index}` === x) || d.find((B) => `${B.prop.index}` === x)
|
|
3325
|
+
), M = c.map(
|
|
3326
|
+
(x) => _.find((B) => `${B.prop.index}` === x) || w.find((B) => `${B.prop.index}` === x)
|
|
3237
3327
|
);
|
|
3238
|
-
if (
|
|
3328
|
+
if (O.some((x) => !x) || M.some((x) => !x))
|
|
3239
3329
|
continue;
|
|
3240
|
-
const m = [
|
|
3241
|
-
(
|
|
3242
|
-
),
|
|
3243
|
-
(
|
|
3330
|
+
const m = [u, d].map(
|
|
3331
|
+
(x) => x.find((B) => !c.includes(`${B.prop.index}`))
|
|
3332
|
+
), v = [_, w].map(
|
|
3333
|
+
(x) => x.find((B) => !c.includes(`${B.prop.index}`))
|
|
3244
3334
|
);
|
|
3245
|
-
if (m.some((
|
|
3335
|
+
if (m.some((x) => !x) || v.some((x) => !x))
|
|
3246
3336
|
continue;
|
|
3247
|
-
const
|
|
3337
|
+
const p = h[0].bakw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), b = h[1].bakw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), g = h[0].forw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), E = h[1].forw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), S = Ee(p), k = Ee(b), P = Ee(g), N = Ee(E), C = fo(
|
|
3248
3338
|
S,
|
|
3249
|
-
|
|
3339
|
+
k,
|
|
3250
3340
|
m,
|
|
3251
|
-
I,
|
|
3252
|
-
t,
|
|
3253
|
-
u
|
|
3254
|
-
), Y = ao(
|
|
3255
3341
|
O,
|
|
3256
|
-
|
|
3342
|
+
t,
|
|
3343
|
+
h
|
|
3344
|
+
), F = ho(
|
|
3345
|
+
P,
|
|
3346
|
+
N,
|
|
3257
3347
|
m,
|
|
3258
|
-
|
|
3348
|
+
O
|
|
3259
3349
|
);
|
|
3260
|
-
if (!(
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
) ||
|
|
3264
|
-
|
|
3265
|
-
|
|
3350
|
+
if (!(C || F || Dn(
|
|
3351
|
+
_t(m[0].geom),
|
|
3352
|
+
b
|
|
3353
|
+
) || Dn(
|
|
3354
|
+
_t(m[1].geom),
|
|
3355
|
+
p
|
|
3266
3356
|
)))
|
|
3267
3357
|
continue;
|
|
3268
|
-
const
|
|
3269
|
-
(
|
|
3270
|
-
),
|
|
3271
|
-
(
|
|
3272
|
-
), T =
|
|
3273
|
-
...
|
|
3274
|
-
...
|
|
3275
|
-
]),
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
) +
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3358
|
+
const I = M.map(
|
|
3359
|
+
(x) => _t(x.geom)
|
|
3360
|
+
), A = v.map(
|
|
3361
|
+
(x) => _t(x.geom)
|
|
3362
|
+
), T = po([
|
|
3363
|
+
...I,
|
|
3364
|
+
...A
|
|
3365
|
+
]), X = mo(T), D = Fn(
|
|
3366
|
+
I[0],
|
|
3367
|
+
I[1],
|
|
3368
|
+
A[0]
|
|
3369
|
+
) + Fn(
|
|
3370
|
+
I[0],
|
|
3371
|
+
I[1],
|
|
3372
|
+
A[1]
|
|
3283
3373
|
);
|
|
3284
|
-
|
|
3285
|
-
if (!
|
|
3286
|
-
const
|
|
3287
|
-
|
|
3374
|
+
qe(X, D) && (Xn(t, h[0], e), Xn(t, h[1], e), O.forEach((x) => {
|
|
3375
|
+
if (!x) return;
|
|
3376
|
+
const B = [
|
|
3377
|
+
x.geom,
|
|
3288
3378
|
m[0].geom,
|
|
3289
3379
|
m[1].geom,
|
|
3290
|
-
|
|
3291
|
-
],
|
|
3292
|
-
a:
|
|
3380
|
+
x.geom
|
|
3381
|
+
], $ = {
|
|
3382
|
+
a: x.prop,
|
|
3293
3383
|
b: m[0].prop,
|
|
3294
3384
|
c: m[1].prop
|
|
3295
|
-
},
|
|
3296
|
-
|
|
3385
|
+
}, Y = le([B], $), L = Jn(Y);
|
|
3386
|
+
ti(t, {
|
|
3297
3387
|
forw: L,
|
|
3298
|
-
bakw:
|
|
3388
|
+
bakw: Y
|
|
3299
3389
|
}, e);
|
|
3300
|
-
}),
|
|
3390
|
+
}), l = !0, s = !0);
|
|
3301
3391
|
}
|
|
3302
|
-
if (!
|
|
3392
|
+
if (!l) break;
|
|
3303
3393
|
}
|
|
3304
3394
|
return s;
|
|
3305
3395
|
}
|
|
3306
|
-
function
|
|
3396
|
+
function _t(e) {
|
|
3307
3397
|
return [e[0], e[1]];
|
|
3308
3398
|
}
|
|
3309
|
-
function
|
|
3310
|
-
const [n, i] = t[0], [o, r] = t[1], [s, a] = t[2],
|
|
3311
|
-
if (
|
|
3312
|
-
const
|
|
3313
|
-
return
|
|
3399
|
+
function Dn(e, t) {
|
|
3400
|
+
const [n, i] = t[0], [o, r] = t[1], [s, a] = t[2], l = s - n, f = a - i, h = o - n, c = r - i, u = e[0] - n, d = e[1] - i, _ = l * l + f * f, w = l * h + f * c, O = l * u + f * d, M = h * h + c * c, m = h * u + c * d, v = _ * M - w * w;
|
|
3401
|
+
if (v === 0) return !1;
|
|
3402
|
+
const p = 1 / v, b = (M * O - w * m) * p, g = (_ * m - w * O) * p, E = 1e-9;
|
|
3403
|
+
return b >= -E && g >= -E && b + g <= 1 + E;
|
|
3314
3404
|
}
|
|
3315
|
-
function
|
|
3405
|
+
function po(e) {
|
|
3316
3406
|
const t = e.map((s) => s.slice()).filter(
|
|
3317
|
-
(s, a,
|
|
3318
|
-
(
|
|
3407
|
+
(s, a, l) => l.findIndex(
|
|
3408
|
+
(f) => qe(f[0], s[0]) && qe(f[1], s[1])
|
|
3319
3409
|
) === a
|
|
3320
3410
|
);
|
|
3321
3411
|
if (t.length <= 1) return t;
|
|
3322
3412
|
const n = t.sort(
|
|
3323
3413
|
(s, a) => s[0] === a[0] ? s[1] - a[1] : s[0] - a[0]
|
|
3324
|
-
), i = (s, a,
|
|
3414
|
+
), i = (s, a, l) => (a[0] - s[0]) * (l[1] - s[1]) - (a[1] - s[1]) * (l[0] - s[0]), o = [];
|
|
3325
3415
|
for (const s of n) {
|
|
3326
3416
|
for (; o.length >= 2 && i(
|
|
3327
3417
|
o[o.length - 2],
|
|
@@ -3344,7 +3434,7 @@ function lo(e) {
|
|
|
3344
3434
|
}
|
|
3345
3435
|
return r.pop(), o.pop(), o.concat(r);
|
|
3346
3436
|
}
|
|
3347
|
-
function
|
|
3437
|
+
function mo(e) {
|
|
3348
3438
|
if (e.length < 3) return 0;
|
|
3349
3439
|
let t = 0;
|
|
3350
3440
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -3353,16 +3443,16 @@ function ho(e) {
|
|
|
3353
3443
|
}
|
|
3354
3444
|
return Math.abs(t) / 2;
|
|
3355
3445
|
}
|
|
3356
|
-
function
|
|
3446
|
+
function Fn(e, t, n) {
|
|
3357
3447
|
return Math.abs(
|
|
3358
3448
|
(e[0] * (t[1] - n[1]) + t[0] * (n[1] - e[1]) + n[0] * (e[1] - t[1])) / 2
|
|
3359
3449
|
);
|
|
3360
3450
|
}
|
|
3361
|
-
function
|
|
3451
|
+
function qe(e, t, n = 1e-9) {
|
|
3362
3452
|
return Math.abs(e - t) <= n;
|
|
3363
3453
|
}
|
|
3364
|
-
const
|
|
3365
|
-
class
|
|
3454
|
+
const Yn = 2.00704, Rn = 3.00001;
|
|
3455
|
+
class lt extends St {
|
|
3366
3456
|
importance;
|
|
3367
3457
|
priority;
|
|
3368
3458
|
pointsSet;
|
|
@@ -3372,20 +3462,20 @@ class ht extends Mt {
|
|
|
3372
3462
|
* @param options - 初期化オプション
|
|
3373
3463
|
*/
|
|
3374
3464
|
constructor(t = {}) {
|
|
3375
|
-
super(), t.bounds ? this.setBounds(t.bounds) : (this.setWh(t.wh), this.vertexMode = t.vertexMode ||
|
|
3465
|
+
super(), t.bounds ? this.setBounds(t.bounds) : (this.setWh(t.wh), this.vertexMode = t.vertexMode || lt.VERTEX_PLAIN), this.strictMode = t.strictMode || lt.MODE_AUTO, this.yaxisMode = t.yaxisMode || lt.YAXIS_INVERT, this.importance = t.importance || 0, this.priority = t.priority || 0, this.stateFull = t.stateFull || !1, this.useV2Algorithm = t.useV2Algorithm ?? !1, t.points && this.setPoints(t.points), t.edges && this.setEdges(t.edges);
|
|
3376
3466
|
}
|
|
3377
3467
|
/**
|
|
3378
3468
|
* フォーマットバージョンを取得します
|
|
3379
3469
|
*/
|
|
3380
3470
|
getFormatVersion() {
|
|
3381
|
-
return this.useV2Algorithm ?
|
|
3471
|
+
return this.useV2Algorithm ? Yn : Rn;
|
|
3382
3472
|
}
|
|
3383
3473
|
/**
|
|
3384
3474
|
* 制御点(GCP: Ground Control Points)を設定します。
|
|
3385
3475
|
* 指定した点群に合わせて内部のTINキャッシュをリセットします。
|
|
3386
3476
|
*/
|
|
3387
3477
|
setPoints(t) {
|
|
3388
|
-
this.yaxisMode ===
|
|
3478
|
+
this.yaxisMode === lt.YAXIS_FOLLOW && (t = t.map((n) => [
|
|
3389
3479
|
n[0],
|
|
3390
3480
|
[n[1][0], -1 * n[1][1]]
|
|
3391
3481
|
])), this.points = t, this.tins = void 0, this.indexedTins = void 0;
|
|
@@ -3395,7 +3485,7 @@ class ht extends Mt {
|
|
|
3395
3485
|
* 制約線を正規化した上で、依存するキャッシュをリセットします。
|
|
3396
3486
|
*/
|
|
3397
3487
|
setEdges(t = []) {
|
|
3398
|
-
this.edges =
|
|
3488
|
+
this.edges = Gn(t), this.edgeNodes = void 0, this.tins = void 0, this.indexedTins = void 0;
|
|
3399
3489
|
}
|
|
3400
3490
|
/**
|
|
3401
3491
|
* 境界ポリゴンを設定します
|
|
@@ -3405,17 +3495,17 @@ class ht extends Mt {
|
|
|
3405
3495
|
let n = t[0][0], i = n, o = t[0][1], r = o;
|
|
3406
3496
|
const s = [t[0]];
|
|
3407
3497
|
for (let a = 1; a < t.length; a++) {
|
|
3408
|
-
const
|
|
3409
|
-
|
|
3498
|
+
const l = t[a];
|
|
3499
|
+
l[0] < n && (n = l[0]), l[0] > i && (i = l[0]), l[1] < o && (o = l[1]), l[1] > r && (r = l[1]), s.push(l);
|
|
3410
3500
|
}
|
|
3411
|
-
s.push(t[0]), this.boundsPolygon = le([s]), this.xy = [n, o], this.wh = [i - n, r - o], this.vertexMode =
|
|
3501
|
+
s.push(t[0]), this.boundsPolygon = le([s]), this.xy = [n, o], this.wh = [i - n, r - o], this.vertexMode = lt.VERTEX_PLAIN, this.tins = void 0, this.indexedTins = void 0;
|
|
3412
3502
|
}
|
|
3413
3503
|
/**
|
|
3414
3504
|
* 現在の設定を永続化可能な形式にコンパイルします
|
|
3415
3505
|
*/
|
|
3416
3506
|
getCompiled() {
|
|
3417
3507
|
const t = {};
|
|
3418
|
-
t.version = this.useV2Algorithm ?
|
|
3508
|
+
t.version = this.useV2Algorithm ? Yn : Rn, t.points = this.points, t.weight_buffer = {}, t.centroid_point = [
|
|
3419
3509
|
this.centroid.forw.geometry.coordinates,
|
|
3420
3510
|
this.centroid.forw.properties.target.geom
|
|
3421
3511
|
], t.vertices_params = [
|
|
@@ -3434,13 +3524,13 @@ class ht extends Mt {
|
|
|
3434
3524
|
(o) => i.properties[o].index
|
|
3435
3525
|
)
|
|
3436
3526
|
);
|
|
3437
|
-
}), this.strict_status ===
|
|
3527
|
+
}), this.strict_status === lt.STATUS_LOOSE ? (t.tins_points[1] = [], this.tins.bakw.features.map((i) => {
|
|
3438
3528
|
t.tins_points[1].push(
|
|
3439
3529
|
["a", "b", "c"].map(
|
|
3440
3530
|
(o) => i.properties[o].index
|
|
3441
3531
|
)
|
|
3442
3532
|
);
|
|
3443
|
-
})) : this.strict_status ===
|
|
3533
|
+
})) : this.strict_status === lt.STATUS_ERROR && this.kinks?.bakw && (t.kinks_points = this.kinks.bakw.features.map(
|
|
3444
3534
|
(i) => i.geometry.coordinates
|
|
3445
3535
|
)), t.yaxisMode = this.yaxisMode, t.vertexMode = this.vertexMode, t.strictMode = this.strictMode, this.bounds ? (t.bounds = this.bounds, t.boundsPolygon = this.boundsPolygon, this.useV2Algorithm && (t.xy = this.xy, t.wh = this.wh)) : t.wh = this.wh, t.edges = this.edges ?? [], t.edgeNodes = this.edgeNodes ?? [], t;
|
|
3446
3536
|
}
|
|
@@ -3473,35 +3563,38 @@ class ht extends Mt {
|
|
|
3473
3563
|
}
|
|
3474
3564
|
/**
|
|
3475
3565
|
* 厳密なTINを計算します
|
|
3566
|
+
*
|
|
3567
|
+
* @param kinkLimit - forw / bakw それぞれで残す交差(kinks)の件数の上限
|
|
3568
|
+
* (同じ位置の交差を 1 件に数えた件数)。届いた時点で数え上げをやめます
|
|
3476
3569
|
*/
|
|
3477
|
-
calculateStrictTin() {
|
|
3478
|
-
const
|
|
3479
|
-
(
|
|
3570
|
+
calculateStrictTin(t = Nn) {
|
|
3571
|
+
const n = this.tins.forw.features.map(
|
|
3572
|
+
(s) => Jn(s)
|
|
3480
3573
|
);
|
|
3481
|
-
this.tins.bakw =
|
|
3482
|
-
const
|
|
3483
|
-
this.tins.forw.features.forEach((
|
|
3484
|
-
const
|
|
3485
|
-
|
|
3574
|
+
this.tins.bakw = Et(n);
|
|
3575
|
+
const i = {};
|
|
3576
|
+
this.tins.forw.features.forEach((s, a) => {
|
|
3577
|
+
const l = this.tins.bakw.features[a];
|
|
3578
|
+
ti(i, { forw: s, bakw: l });
|
|
3486
3579
|
});
|
|
3487
|
-
const
|
|
3488
|
-
(
|
|
3580
|
+
const o = (this.pointsSet?.forw.features ?? []).map(
|
|
3581
|
+
(s) => s.properties.target.index
|
|
3489
3582
|
);
|
|
3490
|
-
|
|
3583
|
+
uo(
|
|
3491
3584
|
this.tins,
|
|
3492
|
-
|
|
3585
|
+
i,
|
|
3493
3586
|
this.pointsSet?.edges || [],
|
|
3494
|
-
|
|
3587
|
+
o
|
|
3495
3588
|
);
|
|
3496
|
-
const
|
|
3497
|
-
const
|
|
3498
|
-
(
|
|
3589
|
+
const r = ["forw", "bakw"].map((s) => {
|
|
3590
|
+
const a = this.tins[s].features.map(
|
|
3591
|
+
(l) => l.geometry.coordinates[0]
|
|
3499
3592
|
);
|
|
3500
|
-
return
|
|
3593
|
+
return Hn(a, t);
|
|
3501
3594
|
});
|
|
3502
|
-
|
|
3503
|
-
forw:
|
|
3504
|
-
bakw:
|
|
3595
|
+
r[0].length === 0 && r[1].length === 0 ? (this.strict_status = lt.STATUS_STRICT, delete this.kinks) : (this.strict_status = lt.STATUS_ERROR, this.kinks = {
|
|
3596
|
+
forw: Et(r[0]),
|
|
3597
|
+
bakw: Et(r[1])
|
|
3505
3598
|
});
|
|
3506
3599
|
}
|
|
3507
3600
|
/**
|
|
@@ -3522,63 +3615,63 @@ class ht extends Mt {
|
|
|
3522
3615
|
this.edgeNodes = [], this.edges || (this.edges = []);
|
|
3523
3616
|
for (let o = 0; o < this.edges.length; o++) {
|
|
3524
3617
|
const r = this.edges[o][2], s = Object.assign([], this.edges[o][0]), a = Object.assign([], this.edges[o][1]);
|
|
3525
|
-
if (s.length === 0 && a.length === 0) {
|
|
3618
|
+
if (go(r, this.points.length, o), s.length === 0 && a.length === 0) {
|
|
3526
3619
|
n.push(r);
|
|
3527
3620
|
continue;
|
|
3528
3621
|
}
|
|
3529
3622
|
s.unshift(this.points[r[0]][0]), s.push(this.points[r[1]][0]), a.unshift(this.points[r[0]][1]), a.push(this.points[r[1]][1]);
|
|
3530
|
-
const
|
|
3531
|
-
const
|
|
3532
|
-
if (
|
|
3533
|
-
const w =
|
|
3623
|
+
const l = [s, a].map((f) => {
|
|
3624
|
+
const h = f.map((u, d, _) => {
|
|
3625
|
+
if (d === 0) return 0;
|
|
3626
|
+
const w = _[d - 1];
|
|
3534
3627
|
return Math.sqrt(
|
|
3535
|
-
Math.pow(
|
|
3628
|
+
Math.pow(u[0] - w[0], 2) + Math.pow(u[1] - w[1], 2)
|
|
3536
3629
|
);
|
|
3537
|
-
}), c =
|
|
3538
|
-
return c.map((
|
|
3539
|
-
const w =
|
|
3540
|
-
return [
|
|
3630
|
+
}), c = h.reduce((u, d, _) => _ === 0 ? [0] : (u.push(u[_ - 1] + d), u), []);
|
|
3631
|
+
return c.map((u, d, _) => {
|
|
3632
|
+
const w = u / _[_.length - 1];
|
|
3633
|
+
return [f[d], h[d], c[d], w];
|
|
3541
3634
|
});
|
|
3542
3635
|
});
|
|
3543
|
-
|
|
3544
|
-
const c = h
|
|
3545
|
-
return
|
|
3546
|
-
const
|
|
3547
|
-
(
|
|
3548
|
-
if (
|
|
3549
|
-
const
|
|
3550
|
-
if (
|
|
3551
|
-
return
|
|
3552
|
-
if (
|
|
3553
|
-
return [
|
|
3636
|
+
l.map((f, h) => {
|
|
3637
|
+
const c = l[h ? 0 : 1];
|
|
3638
|
+
return f.filter((u, d) => !(d === 0 || d === f.length - 1 || u[4] === "handled")).flatMap((u) => {
|
|
3639
|
+
const d = u[0], _ = u[3], w = c.reduce(
|
|
3640
|
+
(O, M, m, v) => {
|
|
3641
|
+
if (O) return O;
|
|
3642
|
+
const p = v[m + 1];
|
|
3643
|
+
if (M[3] === _)
|
|
3644
|
+
return M[4] = "handled", [M];
|
|
3645
|
+
if (M[3] < _ && p && p[3] > _)
|
|
3646
|
+
return [M, p];
|
|
3554
3647
|
},
|
|
3555
3648
|
void 0
|
|
3556
3649
|
);
|
|
3557
3650
|
if (w && w.length === 1)
|
|
3558
|
-
return
|
|
3651
|
+
return h === 0 ? [[d, w[0][0], _]] : [[w[0][0], d, _]];
|
|
3559
3652
|
if (w && w.length === 2) {
|
|
3560
|
-
const
|
|
3561
|
-
(
|
|
3562
|
-
(
|
|
3653
|
+
const O = w[0], M = w[1], m = (_ - O[3]) / (M[3] - O[3]), v = [
|
|
3654
|
+
(M[0][0] - O[0][0]) * m + O[0][0],
|
|
3655
|
+
(M[0][1] - O[0][1]) * m + O[0][1]
|
|
3563
3656
|
];
|
|
3564
|
-
return
|
|
3657
|
+
return h === 0 ? [[d, v, _]] : [[v, d, _]];
|
|
3565
3658
|
}
|
|
3566
3659
|
return [];
|
|
3567
3660
|
});
|
|
3568
|
-
}).reduce((
|
|
3661
|
+
}).reduce((f, h) => f.concat(h), []).sort((f, h) => f[2] < h[2] ? -1 : 1).map((f, h, c) => {
|
|
3569
3662
|
this.edgeNodes[i] = [
|
|
3570
|
-
|
|
3571
|
-
|
|
3663
|
+
f[0],
|
|
3664
|
+
f[1]
|
|
3572
3665
|
];
|
|
3573
|
-
const
|
|
3574
|
-
|
|
3575
|
-
|
|
3666
|
+
const u = Me(
|
|
3667
|
+
f[0],
|
|
3668
|
+
f[1],
|
|
3576
3669
|
`e${i}`
|
|
3577
3670
|
);
|
|
3578
|
-
i++, t.forw.push(
|
|
3671
|
+
i++, t.forw.push(u), t.bakw.push(Se(u)), h === 0 ? n.push([r[0], t.forw.length - 1]) : n.push([
|
|
3579
3672
|
t.forw.length - 2,
|
|
3580
3673
|
t.forw.length - 1
|
|
3581
|
-
]),
|
|
3674
|
+
]), h === c.length - 1 && n.push([t.forw.length - 1, r[1]]);
|
|
3582
3675
|
});
|
|
3583
3676
|
}
|
|
3584
3677
|
return {
|
|
@@ -3594,7 +3687,7 @@ class ht extends Mt {
|
|
|
3594
3687
|
const t = this.xy[0] - 0.05 * this.wh[0], n = this.xy[0] + 1.05 * this.wh[0], i = this.xy[1] - 0.05 * this.wh[1], o = this.xy[1] + 1.05 * this.wh[1];
|
|
3595
3688
|
if (this.bounds && !this.boundsPolygon) throw new Error("Internal error: bounds is set but boundsPolygon is missing");
|
|
3596
3689
|
const r = this.bounds ? this.boundsPolygon : void 0;
|
|
3597
|
-
if (!this.points.reduce((
|
|
3690
|
+
if (!this.points.reduce((l, f) => l && (r ? $e(f[0], r) : f[0][0] >= t && f[0][0] <= n && f[0][1] >= i && f[0][1] <= o), !0))
|
|
3598
3691
|
throw "SOME POINTS OUTSIDE";
|
|
3599
3692
|
let a = [];
|
|
3600
3693
|
return this.wh && (a = [[t, i], [n, i], [t, o], [n, o]]), {
|
|
@@ -3613,8 +3706,8 @@ class ht extends Mt {
|
|
|
3613
3706
|
computeGcpBbox() {
|
|
3614
3707
|
let t = 1 / 0, n = -1 / 0, i = 1 / 0, o = -1 / 0;
|
|
3615
3708
|
for (const a of this.points) {
|
|
3616
|
-
const
|
|
3617
|
-
|
|
3709
|
+
const l = a[0][0], f = a[0][1];
|
|
3710
|
+
l < t && (t = l), l > n && (n = l), f < i && (i = f), f > o && (o = f);
|
|
3618
3711
|
}
|
|
3619
3712
|
const r = n - t, s = o - i;
|
|
3620
3713
|
return {
|
|
@@ -3631,7 +3724,7 @@ class ht extends Mt {
|
|
|
3631
3724
|
*/
|
|
3632
3725
|
updateTin() {
|
|
3633
3726
|
let t = this.strictMode;
|
|
3634
|
-
t !==
|
|
3727
|
+
t !== lt.MODE_STRICT && t !== lt.MODE_LOOSE && (t = lt.MODE_AUTO);
|
|
3635
3728
|
const n = !this.useV2Algorithm;
|
|
3636
3729
|
let i, o, r, s, a;
|
|
3637
3730
|
if (n) {
|
|
@@ -3639,7 +3732,7 @@ class ht extends Mt {
|
|
|
3639
3732
|
const S = this.boundsPolygon;
|
|
3640
3733
|
if (!S) throw new Error("Internal error: bounds is set but boundsPolygon is missing");
|
|
3641
3734
|
if (!this.points.every(
|
|
3642
|
-
(
|
|
3735
|
+
(P) => $e(P[0], S)
|
|
3643
3736
|
)) throw "SOME POINTS OUTSIDE";
|
|
3644
3737
|
}
|
|
3645
3738
|
i = this.generatePointsSet(), { minx: o, maxx: r, miny: s, maxy: a } = this.computeGcpBbox();
|
|
@@ -3647,122 +3740,124 @@ class ht extends Mt {
|
|
|
3647
3740
|
const S = this.validateAndPrepareInputs();
|
|
3648
3741
|
i = S.pointsSet, o = S.minx, r = S.maxx, s = S.miny, a = S.maxy;
|
|
3649
3742
|
}
|
|
3650
|
-
const
|
|
3651
|
-
forw:
|
|
3652
|
-
bakw:
|
|
3653
|
-
},
|
|
3654
|
-
|
|
3743
|
+
const l = {
|
|
3744
|
+
forw: Et(i.forw),
|
|
3745
|
+
bakw: Et(i.bakw)
|
|
3746
|
+
}, f = be(
|
|
3747
|
+
l.forw,
|
|
3655
3748
|
i.edges,
|
|
3656
3749
|
"target"
|
|
3657
|
-
),
|
|
3658
|
-
|
|
3750
|
+
), h = be(
|
|
3751
|
+
l.bakw,
|
|
3659
3752
|
i.edges,
|
|
3660
3753
|
"target"
|
|
3661
3754
|
);
|
|
3662
|
-
if (
|
|
3755
|
+
if (f.features.length === 0 || h.features.length === 0)
|
|
3663
3756
|
throw "TOO LINEAR1";
|
|
3664
|
-
const c =
|
|
3665
|
-
if (!
|
|
3666
|
-
const
|
|
3757
|
+
const c = Xi(l.forw), u = mn(l.forw);
|
|
3758
|
+
if (!u) throw "TOO LINEAR2";
|
|
3759
|
+
const d = {}, _ = u.geometry.coordinates[0];
|
|
3667
3760
|
let w;
|
|
3668
3761
|
try {
|
|
3669
|
-
w =
|
|
3762
|
+
w = _.map((S) => ({
|
|
3670
3763
|
forw: S,
|
|
3671
|
-
bakw: ne(
|
|
3764
|
+
bakw: ne(Rt(S), f)
|
|
3672
3765
|
})), w.forEach((S) => {
|
|
3673
|
-
|
|
3766
|
+
d[`${S.forw[0]}:${S.forw[1]}`] = S;
|
|
3674
3767
|
});
|
|
3675
3768
|
} catch {
|
|
3676
3769
|
throw "TOO LINEAR2";
|
|
3677
3770
|
}
|
|
3678
|
-
const
|
|
3679
|
-
if (!
|
|
3680
|
-
const
|
|
3771
|
+
const O = mn(l.bakw);
|
|
3772
|
+
if (!O) throw "TOO LINEAR2";
|
|
3773
|
+
const M = O.geometry.coordinates[0];
|
|
3681
3774
|
try {
|
|
3682
|
-
w =
|
|
3775
|
+
w = M.map((S) => ({
|
|
3683
3776
|
bakw: S,
|
|
3684
|
-
forw: ne(
|
|
3777
|
+
forw: ne(Rt(S), h)
|
|
3685
3778
|
})), w.forEach((S) => {
|
|
3686
|
-
|
|
3779
|
+
d[`${S.forw[0]}:${S.forw[1]}`] = S;
|
|
3687
3780
|
});
|
|
3688
3781
|
} catch {
|
|
3689
3782
|
throw "TOO LINEAR2";
|
|
3690
3783
|
}
|
|
3691
3784
|
let m;
|
|
3692
3785
|
if (n) {
|
|
3693
|
-
const S = c.geometry.coordinates,
|
|
3694
|
-
(
|
|
3695
|
-
|
|
3696
|
-
|
|
3786
|
+
const S = c.geometry.coordinates, k = f.features.find(
|
|
3787
|
+
(P) => $e(
|
|
3788
|
+
Rt(S),
|
|
3789
|
+
P
|
|
3697
3790
|
)
|
|
3698
3791
|
);
|
|
3699
|
-
if (
|
|
3700
|
-
const
|
|
3792
|
+
if (k) {
|
|
3793
|
+
const P = k.geometry.coordinates[0], N = k.properties.a.geom, C = k.properties.b.geom, F = k.properties.c.geom;
|
|
3701
3794
|
m = {
|
|
3702
3795
|
forw: [
|
|
3703
|
-
(
|
|
3704
|
-
(
|
|
3796
|
+
(P[0][0] + P[1][0] + P[2][0]) / 3,
|
|
3797
|
+
(P[0][1] + P[1][1] + P[2][1]) / 3
|
|
3705
3798
|
],
|
|
3706
3799
|
bakw: [
|
|
3707
|
-
(
|
|
3708
|
-
(
|
|
3800
|
+
(N[0] + C[0] + F[0]) / 3,
|
|
3801
|
+
(N[1] + C[1] + F[1]) / 3
|
|
3709
3802
|
]
|
|
3710
3803
|
};
|
|
3711
3804
|
} else
|
|
3712
3805
|
m = {
|
|
3713
3806
|
forw: S,
|
|
3714
|
-
bakw: ne(c,
|
|
3807
|
+
bakw: ne(c, f)
|
|
3715
3808
|
};
|
|
3716
3809
|
} else
|
|
3717
3810
|
m = {
|
|
3718
3811
|
forw: c.geometry.coordinates,
|
|
3719
|
-
bakw: ne(c,
|
|
3812
|
+
bakw: ne(c, f)
|
|
3720
3813
|
};
|
|
3721
|
-
const
|
|
3814
|
+
const v = Me(m.forw, m.bakw, "c");
|
|
3722
3815
|
this.centroid = {
|
|
3723
|
-
forw:
|
|
3724
|
-
bakw: Se(
|
|
3816
|
+
forw: v,
|
|
3817
|
+
bakw: Se(v)
|
|
3725
3818
|
};
|
|
3726
|
-
const
|
|
3819
|
+
const p = [
|
|
3727
3820
|
...this.points.map((S) => ({ forw: S[0], bakw: S[1] })),
|
|
3728
3821
|
...(this.edgeNodes ?? []).map((S) => ({ forw: S[0], bakw: S[1] }))
|
|
3729
|
-
],
|
|
3730
|
-
convexBuf:
|
|
3822
|
+
], b = {
|
|
3823
|
+
convexBuf: d,
|
|
3731
3824
|
centroid: m,
|
|
3732
|
-
allGcps:
|
|
3825
|
+
allGcps: p,
|
|
3733
3826
|
minx: o,
|
|
3734
3827
|
maxx: r,
|
|
3735
3828
|
miny: s,
|
|
3736
3829
|
maxy: a
|
|
3737
|
-
}, g = this.vertexMode ===
|
|
3830
|
+
}, g = this.vertexMode === lt.VERTEX_BIRDEYE ? Dr(b, n) : $r(b, n), E = {
|
|
3738
3831
|
forw: [],
|
|
3739
3832
|
bakw: []
|
|
3740
3833
|
};
|
|
3741
3834
|
for (let S = 0; S < g.length; S++) {
|
|
3742
|
-
const
|
|
3743
|
-
i.forw.push(
|
|
3835
|
+
const k = g[S].forw, P = g[S].bakw, N = Me(k, P, `b${S}`), C = Se(N);
|
|
3836
|
+
i.forw.push(N), i.bakw.push(C), E.forw.push(N), E.bakw.push(C);
|
|
3744
3837
|
}
|
|
3745
3838
|
this.pointsSet = {
|
|
3746
|
-
forw:
|
|
3747
|
-
bakw:
|
|
3839
|
+
forw: Et(i.forw),
|
|
3840
|
+
bakw: Et(i.bakw),
|
|
3748
3841
|
edges: i.edges
|
|
3749
3842
|
}, this.tins = {
|
|
3750
|
-
forw:
|
|
3843
|
+
forw: Mn(
|
|
3751
3844
|
be(
|
|
3752
3845
|
this.pointsSet.forw,
|
|
3753
3846
|
i.edges,
|
|
3754
3847
|
"target"
|
|
3755
3848
|
)
|
|
3756
3849
|
)
|
|
3757
|
-
}, (t ===
|
|
3850
|
+
}, (t === lt.MODE_STRICT || t === lt.MODE_AUTO) && this.calculateStrictTin(
|
|
3851
|
+
t === lt.MODE_AUTO ? 1 : Nn
|
|
3852
|
+
), (t === lt.MODE_LOOSE || t === lt.MODE_AUTO && this.strict_status === lt.STATUS_ERROR) && (this.tins.bakw = Mn(
|
|
3758
3853
|
be(
|
|
3759
3854
|
this.pointsSet.bakw,
|
|
3760
3855
|
i.edges,
|
|
3761
3856
|
"target"
|
|
3762
3857
|
)
|
|
3763
|
-
), delete this.kinks, this.strict_status =
|
|
3764
|
-
forw:
|
|
3765
|
-
bakw:
|
|
3858
|
+
), delete this.kinks, this.strict_status = lt.STATUS_LOOSE), this.vertices_params = {
|
|
3859
|
+
forw: $n(E.forw, this.centroid.forw),
|
|
3860
|
+
bakw: $n(E.bakw, this.centroid.bakw)
|
|
3766
3861
|
}, this.addIndexedTin(), this.pointsWeightBuffer = {};
|
|
3767
3862
|
}
|
|
3768
3863
|
/**
|
|
@@ -3773,14 +3868,21 @@ class ht extends Mt {
|
|
|
3773
3868
|
this.updateTin();
|
|
3774
3869
|
}
|
|
3775
3870
|
}
|
|
3871
|
+
function go(e, t, n) {
|
|
3872
|
+
const i = (o) => Number.isInteger(o) && o >= 0 && o < t;
|
|
3873
|
+
if (!Array.isArray(e) || !i(e[0]) || !i(e[1]))
|
|
3874
|
+
throw new Error(
|
|
3875
|
+
`Invalid edge at edges[${n}]: start/end ${JSON.stringify(e)} must be integer indices of points (0 to ${t - 1})`
|
|
3876
|
+
);
|
|
3877
|
+
}
|
|
3776
3878
|
export {
|
|
3777
|
-
|
|
3879
|
+
lt as Tin,
|
|
3778
3880
|
be as constrainedTin,
|
|
3779
3881
|
Se as counterPoint,
|
|
3780
3882
|
Me as createPoint,
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3883
|
+
lt as default,
|
|
3884
|
+
wo as findIntersections,
|
|
3885
|
+
Yn as format_version,
|
|
3886
|
+
ti as insertSearchIndex,
|
|
3887
|
+
$n as vertexCalc
|
|
3786
3888
|
};
|