@mui/x-charts-vendor 7.12.0
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.md +76 -0
- package/d3-color.d.ts +5 -0
- package/d3-color.js +7 -0
- package/d3-delaunay.d.ts +5 -0
- package/d3-delaunay.js +7 -0
- package/d3-interpolate.d.ts +5 -0
- package/d3-interpolate.js +7 -0
- package/d3-scale.d.ts +5 -0
- package/d3-scale.js +7 -0
- package/d3-shape.d.ts +5 -0
- package/d3-shape.js +7 -0
- package/d3-time.d.ts +5 -0
- package/d3-time.js +7 -0
- package/es/d3-array.js +6 -0
- package/es/d3-color.js +6 -0
- package/es/d3-delaunay.js +6 -0
- package/es/d3-format.js +6 -0
- package/es/d3-interpolate.js +6 -0
- package/es/d3-path.js +6 -0
- package/es/d3-scale.js +6 -0
- package/es/d3-shape.js +6 -0
- package/es/d3-time-format.js +6 -0
- package/es/d3-time.js +6 -0
- package/es/delaunator.js +6 -0
- package/es/internmap.js +6 -0
- package/es/robust-predicates.js +6 -0
- package/lib/d3-array.js +6 -0
- package/lib/d3-color.js +6 -0
- package/lib/d3-delaunay.js +6 -0
- package/lib/d3-format.js +6 -0
- package/lib/d3-interpolate.js +6 -0
- package/lib/d3-path.js +6 -0
- package/lib/d3-scale.js +6 -0
- package/lib/d3-shape.js +6 -0
- package/lib/d3-time-format.js +6 -0
- package/lib/d3-time.js +6 -0
- package/lib/delaunator.js +6 -0
- package/lib/internmap.js +6 -0
- package/lib/robust-predicates.js +6 -0
- package/lib-vendor/d3-array/LICENSE +13 -0
- package/lib-vendor/d3-array/dist/d3-array.js +1349 -0
- package/lib-vendor/d3-array/dist/d3-array.min.js +777 -0
- package/lib-vendor/d3-array/src/array.js +9 -0
- package/lib-vendor/d3-array/src/ascending.js +9 -0
- package/lib-vendor/d3-array/src/bin.js +126 -0
- package/lib-vendor/d3-array/src/bisect.js +15 -0
- package/lib-vendor/d3-array/src/bisector.js +59 -0
- package/lib-vendor/d3-array/src/blur.js +122 -0
- package/lib-vendor/d3-array/src/constant.js +9 -0
- package/lib-vendor/d3-array/src/count.js +24 -0
- package/lib-vendor/d3-array/src/cross.js +35 -0
- package/lib-vendor/d3-array/src/cumsum.js +11 -0
- package/lib-vendor/d3-array/src/descending.js +9 -0
- package/lib-vendor/d3-array/src/deviation.js +12 -0
- package/lib-vendor/d3-array/src/difference.js +16 -0
- package/lib-vendor/d3-array/src/disjoint.js +24 -0
- package/lib-vendor/d3-array/src/every.js +16 -0
- package/lib-vendor/d3-array/src/extent.js +35 -0
- package/lib-vendor/d3-array/src/filter.js +17 -0
- package/lib-vendor/d3-array/src/fsum.js +77 -0
- package/lib-vendor/d3-array/src/greatest.js +31 -0
- package/lib-vendor/d3-array/src/greatestIndex.js +23 -0
- package/lib-vendor/d3-array/src/group.js +67 -0
- package/lib-vendor/d3-array/src/groupSort.js +15 -0
- package/lib-vendor/d3-array/src/identity.js +9 -0
- package/lib-vendor/d3-array/src/index.js +539 -0
- package/lib-vendor/d3-array/src/intersection.js +23 -0
- package/lib-vendor/d3-array/src/least.js +31 -0
- package/lib-vendor/d3-array/src/leastIndex.js +23 -0
- package/lib-vendor/d3-array/src/map.js +11 -0
- package/lib-vendor/d3-array/src/max.js +24 -0
- package/lib-vendor/d3-array/src/maxIndex.js +26 -0
- package/lib-vendor/d3-array/src/mean.js +25 -0
- package/lib-vendor/d3-array/src/median.js +16 -0
- package/lib-vendor/d3-array/src/merge.js +14 -0
- package/lib-vendor/d3-array/src/min.js +24 -0
- package/lib-vendor/d3-array/src/minIndex.js +26 -0
- package/lib-vendor/d3-array/src/mode.js +33 -0
- package/lib-vendor/d3-array/src/nice.js +23 -0
- package/lib-vendor/d3-array/src/number.js +26 -0
- package/lib-vendor/d3-array/src/pairs.js +21 -0
- package/lib-vendor/d3-array/src/permute.js +9 -0
- package/lib-vendor/d3-array/src/quantile.js +55 -0
- package/lib-vendor/d3-array/src/quickselect.js +47 -0
- package/lib-vendor/d3-array/src/range.js +16 -0
- package/lib-vendor/d3-array/src/rank.js +30 -0
- package/lib-vendor/d3-array/src/reduce.js +28 -0
- package/lib-vendor/d3-array/src/reverse.js +10 -0
- package/lib-vendor/d3-array/src/scan.js +12 -0
- package/lib-vendor/d3-array/src/shuffle.js +20 -0
- package/lib-vendor/d3-array/src/some.js +16 -0
- package/lib-vendor/d3-array/src/sort.js +45 -0
- package/lib-vendor/d3-array/src/subset.js +11 -0
- package/lib-vendor/d3-array/src/sum.js +24 -0
- package/lib-vendor/d3-array/src/superset.js +28 -0
- package/lib-vendor/d3-array/src/threshold/freedmanDiaconis.js +14 -0
- package/lib-vendor/d3-array/src/threshold/scott.js +14 -0
- package/lib-vendor/d3-array/src/threshold/sturges.js +11 -0
- package/lib-vendor/d3-array/src/ticks.js +60 -0
- package/lib-vendor/d3-array/src/transpose.js +20 -0
- package/lib-vendor/d3-array/src/union.js +16 -0
- package/lib-vendor/d3-array/src/variance.js +31 -0
- package/lib-vendor/d3-array/src/zip.js +11 -0
- package/lib-vendor/d3-color/LICENSE +13 -0
- package/lib-vendor/d3-color/dist/d3-color.js +532 -0
- package/lib-vendor/d3-color/dist/d3-color.min.js +446 -0
- package/lib-vendor/d3-color/src/color.js +366 -0
- package/lib-vendor/d3-color/src/cubehelix.js +61 -0
- package/lib-vendor/d3-color/src/define.js +16 -0
- package/lib-vendor/d3-color/src/index.js +59 -0
- package/lib-vendor/d3-color/src/lab.js +117 -0
- package/lib-vendor/d3-color/src/math.js +8 -0
- package/lib-vendor/d3-delaunay/LICENSE +14 -0
- package/lib-vendor/d3-delaunay/dist/d3-delaunay.js +1398 -0
- package/lib-vendor/d3-delaunay/dist/d3-delaunay.min.js +853 -0
- package/lib-vendor/d3-delaunay/src/delaunay.js +282 -0
- package/lib-vendor/d3-delaunay/src/index.js +20 -0
- package/lib-vendor/d3-delaunay/src/path.js +43 -0
- package/lib-vendor/d3-delaunay/src/polygon.js +24 -0
- package/lib-vendor/d3-delaunay/src/voronoi.js +390 -0
- package/lib-vendor/d3-format/LICENSE +13 -0
- package/lib-vendor/d3-format/dist/d3-format.js +313 -0
- package/lib-vendor/d3-format/dist/d3-format.min.js +193 -0
- package/lib-vendor/d3-format/src/defaultLocale.js +23 -0
- package/lib-vendor/d3-format/src/exponent.js +10 -0
- package/lib-vendor/d3-format/src/formatDecimal.js +23 -0
- package/lib-vendor/d3-format/src/formatGroup.js +22 -0
- package/lib-vendor/d3-format/src/formatNumerals.js +13 -0
- package/lib-vendor/d3-format/src/formatPrefixAuto.js +18 -0
- package/lib-vendor/d3-format/src/formatRounded.js +14 -0
- package/lib-vendor/d3-format/src/formatSpecifier.js +42 -0
- package/lib-vendor/d3-format/src/formatTrim.js +25 -0
- package/lib-vendor/d3-format/src/formatTypes.js +25 -0
- package/lib-vendor/d3-format/src/identity.js +9 -0
- package/lib-vendor/d3-format/src/index.js +68 -0
- package/lib-vendor/d3-format/src/locale.js +152 -0
- package/lib-vendor/d3-format/src/precisionFixed.js +11 -0
- package/lib-vendor/d3-format/src/precisionPrefix.js +11 -0
- package/lib-vendor/d3-format/src/precisionRound.js +12 -0
- package/lib-vendor/d3-interpolate/LICENSE +13 -0
- package/lib-vendor/d3-interpolate/dist/d3-interpolate.js +543 -0
- package/lib-vendor/d3-interpolate/dist/d3-interpolate.min.js +362 -0
- package/lib-vendor/d3-interpolate/src/array.js +28 -0
- package/lib-vendor/d3-interpolate/src/basis.js +23 -0
- package/lib-vendor/d3-interpolate/src/basisClosed.js +18 -0
- package/lib-vendor/d3-interpolate/src/color.js +33 -0
- package/lib-vendor/d3-interpolate/src/constant.js +8 -0
- package/lib-vendor/d3-interpolate/src/cubehelix.js +32 -0
- package/lib-vendor/d3-interpolate/src/date.js +12 -0
- package/lib-vendor/d3-interpolate/src/discrete.js +12 -0
- package/lib-vendor/d3-interpolate/src/hcl.js +27 -0
- package/lib-vendor/d3-interpolate/src/hsl.js +27 -0
- package/lib-vendor/d3-interpolate/src/hue.js +14 -0
- package/lib-vendor/d3-interpolate/src/index.js +191 -0
- package/lib-vendor/d3-interpolate/src/lab.js +22 -0
- package/lib-vendor/d3-interpolate/src/number.js +11 -0
- package/lib-vendor/d3-interpolate/src/numberArray.js +20 -0
- package/lib-vendor/d3-interpolate/src/object.js +26 -0
- package/lib-vendor/d3-interpolate/src/piecewise.js +20 -0
- package/lib-vendor/d3-interpolate/src/quantize.js +11 -0
- package/lib-vendor/d3-interpolate/src/rgb.js +59 -0
- package/lib-vendor/d3-interpolate/src/round.js +11 -0
- package/lib-vendor/d3-interpolate/src/string.js +75 -0
- package/lib-vendor/d3-interpolate/src/transform/decompose.js +31 -0
- package/lib-vendor/d3-interpolate/src/transform/index.js +83 -0
- package/lib-vendor/d3-interpolate/src/transform/parse.js +25 -0
- package/lib-vendor/d3-interpolate/src/value.js +23 -0
- package/lib-vendor/d3-interpolate/src/zoom.js +66 -0
- package/lib-vendor/d3-path/LICENSE +13 -0
- package/lib-vendor/d3-path/dist/d3-path.js +161 -0
- package/lib-vendor/d3-path/dist/d3-path.min.js +92 -0
- package/lib-vendor/d3-path/src/index.js +24 -0
- package/lib-vendor/d3-path/src/path.js +158 -0
- package/lib-vendor/d3-scale/LICENSE +13 -0
- package/lib-vendor/d3-scale/dist/d3-scale.js +944 -0
- package/lib-vendor/d3-scale/dist/d3-scale.min.js +690 -0
- package/lib-vendor/d3-scale/src/band.js +87 -0
- package/lib-vendor/d3-scale/src/colors.js +11 -0
- package/lib-vendor/d3-scale/src/constant.js +11 -0
- package/lib-vendor/d3-scale/src/continuous.js +116 -0
- package/lib-vendor/d3-scale/src/diverging.js +91 -0
- package/lib-vendor/d3-scale/src/identity.js +27 -0
- package/lib-vendor/d3-scale/src/index.js +193 -0
- package/lib-vendor/d3-scale/src/init.js +38 -0
- package/lib-vendor/d3-scale/src/linear.js +67 -0
- package/lib-vendor/d3-scale/src/log.js +123 -0
- package/lib-vendor/d3-scale/src/nice.js +21 -0
- package/lib-vendor/d3-scale/src/number.js +9 -0
- package/lib-vendor/d3-scale/src/ordinal.js +44 -0
- package/lib-vendor/d3-scale/src/pow.js +44 -0
- package/lib-vendor/d3-scale/src/quantile.js +48 -0
- package/lib-vendor/d3-scale/src/quantize.js +46 -0
- package/lib-vendor/d3-scale/src/radial.js +53 -0
- package/lib-vendor/d3-scale/src/sequential.js +90 -0
- package/lib-vendor/d3-scale/src/sequentialQuantile.js +38 -0
- package/lib-vendor/d3-scale/src/symlog.js +35 -0
- package/lib-vendor/d3-scale/src/threshold.js +34 -0
- package/lib-vendor/d3-scale/src/tickFormat.js +37 -0
- package/lib-vendor/d3-scale/src/time.js +62 -0
- package/lib-vendor/d3-scale/src/utcTime.js +13 -0
- package/lib-vendor/d3-shape/LICENSE +13 -0
- package/lib-vendor/d3-shape/dist/d3-shape.js +2004 -0
- package/lib-vendor/d3-shape/dist/d3-shape.min.js +1389 -0
- package/lib-vendor/d3-shape/src/arc.js +250 -0
- package/lib-vendor/d3-shape/src/area.js +98 -0
- package/lib-vendor/d3-shape/src/areaRadial.js +42 -0
- package/lib-vendor/d3-shape/src/array.js +12 -0
- package/lib-vendor/d3-shape/src/constant.js +11 -0
- package/lib-vendor/d3-shape/src/curve/basis.js +62 -0
- package/lib-vendor/d3-shape/src/curve/basisClosed.js +70 -0
- package/lib-vendor/d3-shape/src/curve/basisOpen.js +54 -0
- package/lib-vendor/d3-shape/src/curve/bump.js +81 -0
- package/lib-vendor/d3-shape/src/curve/bundle.js +50 -0
- package/lib-vendor/d3-shape/src/curve/cardinal.js +69 -0
- package/lib-vendor/d3-shape/src/curve/cardinalClosed.js +76 -0
- package/lib-vendor/d3-shape/src/curve/cardinalOpen.js +60 -0
- package/lib-vendor/d3-shape/src/curve/catmullRom.js +92 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomClosed.js +83 -0
- package/lib-vendor/d3-shape/src/curve/catmullRomOpen.js +67 -0
- package/lib-vendor/d3-shape/src/curve/linear.js +42 -0
- package/lib-vendor/d3-shape/src/curve/linearClosed.js +28 -0
- package/lib-vendor/d3-shape/src/curve/monotone.js +121 -0
- package/lib-vendor/d3-shape/src/curve/natural.js +67 -0
- package/lib-vendor/d3-shape/src/curve/radial.js +37 -0
- package/lib-vendor/d3-shape/src/curve/step.js +63 -0
- package/lib-vendor/d3-shape/src/descending.js +9 -0
- package/lib-vendor/d3-shape/src/identity.js +9 -0
- package/lib-vendor/d3-shape/src/index.js +436 -0
- package/lib-vendor/d3-shape/src/line.js +52 -0
- package/lib-vendor/d3-shape/src/lineRadial.js +24 -0
- package/lib-vendor/d3-shape/src/link.js +70 -0
- package/lib-vendor/d3-shape/src/math.js +26 -0
- package/lib-vendor/d3-shape/src/noop.js +7 -0
- package/lib-vendor/d3-shape/src/offset/diverging.js +20 -0
- package/lib-vendor/d3-shape/src/offset/expand.js +16 -0
- package/lib-vendor/d3-shape/src/offset/none.js +15 -0
- package/lib-vendor/d3-shape/src/offset/silhouette.js +16 -0
- package/lib-vendor/d3-shape/src/offset/wiggle.js +30 -0
- package/lib-vendor/d3-shape/src/order/appearance.js +23 -0
- package/lib-vendor/d3-shape/src/order/ascending.js +23 -0
- package/lib-vendor/d3-shape/src/order/descending.js +11 -0
- package/lib-vendor/d3-shape/src/order/insideOut.js +31 -0
- package/lib-vendor/d3-shape/src/order/none.js +12 -0
- package/lib-vendor/d3-shape/src/order/reverse.js +11 -0
- package/lib-vendor/d3-shape/src/path.js +22 -0
- package/lib-vendor/d3-shape/src/pie.js +79 -0
- package/lib-vendor/d3-shape/src/point.js +13 -0
- package/lib-vendor/d3-shape/src/pointRadial.js +9 -0
- package/lib-vendor/d3-shape/src/stack.js +55 -0
- package/lib-vendor/d3-shape/src/symbol/asterisk.js +21 -0
- package/lib-vendor/d3-shape/src/symbol/circle.js +14 -0
- package/lib-vendor/d3-shape/src/symbol/cross.js +25 -0
- package/lib-vendor/d3-shape/src/symbol/diamond.js +20 -0
- package/lib-vendor/d3-shape/src/symbol/diamond2.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/plus.js +16 -0
- package/lib-vendor/d3-shape/src/symbol/square.js +14 -0
- package/lib-vendor/d3-shape/src/symbol/square2.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/star.js +28 -0
- package/lib-vendor/d3-shape/src/symbol/times.js +16 -0
- package/lib-vendor/d3-shape/src/symbol/triangle.js +17 -0
- package/lib-vendor/d3-shape/src/symbol/triangle2.js +19 -0
- package/lib-vendor/d3-shape/src/symbol/wye.js +32 -0
- package/lib-vendor/d3-shape/src/symbol.js +50 -0
- package/lib-vendor/d3-time/LICENSE +13 -0
- package/lib-vendor/d3-time/dist/d3-time.js +367 -0
- package/lib-vendor/d3-time/dist/d3-time.min.js +190 -0
- package/lib-vendor/d3-time/src/day.js +30 -0
- package/lib-vendor/d3-time/src/duration.js +13 -0
- package/lib-vendor/d3-time/src/hour.js +28 -0
- package/lib-vendor/d3-time/src/index.js +417 -0
- package/lib-vendor/d3-time/src/interval.js +61 -0
- package/lib-vendor/d3-time/src/millisecond.js +29 -0
- package/lib-vendor/d3-time/src/minute.js +28 -0
- package/lib-vendor/d3-time/src/month.js +29 -0
- package/lib-vendor/d3-time/src/second.js +18 -0
- package/lib-vendor/d3-time/src/ticks.js +41 -0
- package/lib-vendor/d3-time/src/week.js +56 -0
- package/lib-vendor/d3-time/src/year.js +51 -0
- package/lib-vendor/d3-time-format/LICENSE +13 -0
- package/lib-vendor/d3-time-format/dist/d3-time-format.js +648 -0
- package/lib-vendor/d3-time-format/dist/d3-time-format.min.js +528 -0
- package/lib-vendor/d3-time-format/src/defaultLocale.js +32 -0
- package/lib-vendor/d3-time-format/src/index.js +60 -0
- package/lib-vendor/d3-time-format/src/isoFormat.js +13 -0
- package/lib-vendor/d3-time-format/src/isoParse.js +14 -0
- package/lib-vendor/d3-time-format/src/locale.js +606 -0
- package/lib-vendor/delaunator/LICENSE +15 -0
- package/lib-vendor/delaunator/delaunator.js +688 -0
- package/lib-vendor/delaunator/delaunator.min.js +316 -0
- package/lib-vendor/delaunator/index.js +440 -0
- package/lib-vendor/internmap/LICENSE +13 -0
- package/lib-vendor/internmap/dist/internmap.js +93 -0
- package/lib-vendor/internmap/dist/internmap.min.js +81 -0
- package/lib-vendor/internmap/src/index.js +87 -0
- package/lib-vendor/robust-predicates/LICENSE +24 -0
- package/lib-vendor/robust-predicates/esm/incircle.js +667 -0
- package/lib-vendor/robust-predicates/esm/insphere.js +693 -0
- package/lib-vendor/robust-predicates/esm/orient2d.js +174 -0
- package/lib-vendor/robust-predicates/esm/orient3d.js +422 -0
- package/lib-vendor/robust-predicates/esm/util.js +147 -0
- package/lib-vendor/robust-predicates/index.js +57 -0
- package/lib-vendor/robust-predicates/umd/incircle.js +798 -0
- package/lib-vendor/robust-predicates/umd/incircle.min.js +170 -0
- package/lib-vendor/robust-predicates/umd/insphere.js +828 -0
- package/lib-vendor/robust-predicates/umd/insphere.min.js +223 -0
- package/lib-vendor/robust-predicates/umd/orient2d.js +260 -0
- package/lib-vendor/robust-predicates/umd/orient2d.min.js +69 -0
- package/lib-vendor/robust-predicates/umd/orient3d.js +550 -0
- package/lib-vendor/robust-predicates/umd/orient3d.min.js +133 -0
- package/lib-vendor/robust-predicates/umd/predicates.js +2073 -0
- package/lib-vendor/robust-predicates/umd/predicates.min.js +468 -0
- package/package.json +63 -0
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// https://github.com/d3/d3-delaunay v6.0.4 Copyright 2018-2021 Observable, Inc., 2021 Mapbox
|
|
4
|
+
!function (t, i) {
|
|
5
|
+
"object" == typeof exports && "undefined" != typeof module ? i(exports) : "function" == typeof define && define.amd ? define(["exports"], i) : i((t = "undefined" != typeof globalThis ? globalThis : t || self).d3 = t.d3 || {});
|
|
6
|
+
}(this, function (t) {
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
const i = 134217729;
|
|
10
|
+
function e(t, i, e, n, s) {
|
|
11
|
+
let l,
|
|
12
|
+
h,
|
|
13
|
+
r,
|
|
14
|
+
o,
|
|
15
|
+
a = i[0],
|
|
16
|
+
c = n[0],
|
|
17
|
+
u = 0,
|
|
18
|
+
f = 0;
|
|
19
|
+
c > a == c > -a ? (l = a, a = i[++u]) : (l = c, c = n[++f]);
|
|
20
|
+
let _ = 0;
|
|
21
|
+
if (u < t && f < e) for (c > a == c > -a ? (h = a + l, r = l - (h - a), a = i[++u]) : (h = c + l, r = l - (h - c), c = n[++f]), l = h, 0 !== r && (s[_++] = r); u < t && f < e;) c > a == c > -a ? (h = l + a, o = h - l, r = l - (h - o) + (a - o), a = i[++u]) : (h = l + c, o = h - l, r = l - (h - o) + (c - o), c = n[++f]), l = h, 0 !== r && (s[_++] = r);
|
|
22
|
+
for (; u < t;) h = l + a, o = h - l, r = l - (h - o) + (a - o), a = i[++u], l = h, 0 !== r && (s[_++] = r);
|
|
23
|
+
for (; f < e;) h = l + c, o = h - l, r = l - (h - o) + (c - o), c = n[++f], l = h, 0 !== r && (s[_++] = r);
|
|
24
|
+
return 0 === l && 0 !== _ || (s[_++] = l), _;
|
|
25
|
+
}
|
|
26
|
+
function n(t) {
|
|
27
|
+
return new Float64Array(t);
|
|
28
|
+
}
|
|
29
|
+
const s = n(4),
|
|
30
|
+
l = n(8),
|
|
31
|
+
h = n(12),
|
|
32
|
+
r = n(16),
|
|
33
|
+
o = n(4);
|
|
34
|
+
function a(t, n, a, c, u, f) {
|
|
35
|
+
const _ = (n - f) * (a - u),
|
|
36
|
+
d = (t - u) * (c - f),
|
|
37
|
+
g = _ - d;
|
|
38
|
+
if (0 === _ || 0 === d || _ > 0 != d > 0) return g;
|
|
39
|
+
const y = Math.abs(_ + d);
|
|
40
|
+
return Math.abs(g) >= 33306690738754716e-32 * y ? g : -function (t, n, a, c, u, f, _) {
|
|
41
|
+
let d, g, y, m, x, p, w, v, b, T, M, A, k, $, P, S, I, z;
|
|
42
|
+
const F = t - u,
|
|
43
|
+
U = a - u,
|
|
44
|
+
K = n - f,
|
|
45
|
+
L = c - f;
|
|
46
|
+
$ = F * L, p = i * F, w = p - (p - F), v = F - w, p = i * L, b = p - (p - L), T = L - b, P = v * T - ($ - w * b - v * b - w * T), S = K * U, p = i * K, w = p - (p - K), v = K - w, p = i * U, b = p - (p - U), T = U - b, I = v * T - (S - w * b - v * b - w * T), M = P - I, x = P - M, s[0] = P - (M + x) + (x - I), A = $ + M, x = A - $, k = $ - (A - x) + (M - x), M = k - S, x = k - M, s[1] = k - (M + x) + (x - S), z = A + M, x = z - A, s[2] = A - (z - x) + (M - x), s[3] = z;
|
|
47
|
+
let j = function (t, i) {
|
|
48
|
+
let e = i[0];
|
|
49
|
+
for (let n = 1; n < t; n++) e += i[n];
|
|
50
|
+
return e;
|
|
51
|
+
}(4, s),
|
|
52
|
+
H = 22204460492503146e-32 * _;
|
|
53
|
+
if (j >= H || -j >= H) return j;
|
|
54
|
+
if (x = t - F, d = t - (F + x) + (x - u), x = a - U, y = a - (U + x) + (x - u), x = n - K, g = n - (K + x) + (x - f), x = c - L, m = c - (L + x) + (x - f), 0 === d && 0 === g && 0 === y && 0 === m) return j;
|
|
55
|
+
if (H = 11093356479670487e-47 * _ + 33306690738754706e-32 * Math.abs(j), j += F * m + L * d - (K * y + U * g), j >= H || -j >= H) return j;
|
|
56
|
+
$ = d * L, p = i * d, w = p - (p - d), v = d - w, p = i * L, b = p - (p - L), T = L - b, P = v * T - ($ - w * b - v * b - w * T), S = g * U, p = i * g, w = p - (p - g), v = g - w, p = i * U, b = p - (p - U), T = U - b, I = v * T - (S - w * b - v * b - w * T), M = P - I, x = P - M, o[0] = P - (M + x) + (x - I), A = $ + M, x = A - $, k = $ - (A - x) + (M - x), M = k - S, x = k - M, o[1] = k - (M + x) + (x - S), z = A + M, x = z - A, o[2] = A - (z - x) + (M - x), o[3] = z;
|
|
57
|
+
const E = e(4, s, 4, o, l);
|
|
58
|
+
$ = F * m, p = i * F, w = p - (p - F), v = F - w, p = i * m, b = p - (p - m), T = m - b, P = v * T - ($ - w * b - v * b - w * T), S = K * y, p = i * K, w = p - (p - K), v = K - w, p = i * y, b = p - (p - y), T = y - b, I = v * T - (S - w * b - v * b - w * T), M = P - I, x = P - M, o[0] = P - (M + x) + (x - I), A = $ + M, x = A - $, k = $ - (A - x) + (M - x), M = k - S, x = k - M, o[1] = k - (M + x) + (x - S), z = A + M, x = z - A, o[2] = A - (z - x) + (M - x), o[3] = z;
|
|
59
|
+
const C = e(E, l, 4, o, h);
|
|
60
|
+
$ = d * m, p = i * d, w = p - (p - d), v = d - w, p = i * m, b = p - (p - m), T = m - b, P = v * T - ($ - w * b - v * b - w * T), S = g * y, p = i * g, w = p - (p - g), v = g - w, p = i * y, b = p - (p - y), T = y - b, I = v * T - (S - w * b - v * b - w * T), M = P - I, x = P - M, o[0] = P - (M + x) + (x - I), A = $ + M, x = A - $, k = $ - (A - x) + (M - x), M = k - S, x = k - M, o[1] = k - (M + x) + (x - S), z = A + M, x = z - A, o[2] = A - (z - x) + (M - x), o[3] = z;
|
|
61
|
+
const N = e(C, h, 4, o, r);
|
|
62
|
+
return r[N - 1];
|
|
63
|
+
}(t, n, a, c, u, f, y);
|
|
64
|
+
}
|
|
65
|
+
const c = Math.pow(2, -52),
|
|
66
|
+
u = new Uint32Array(512);
|
|
67
|
+
class f {
|
|
68
|
+
static from(t, i = x, e = p) {
|
|
69
|
+
const n = t.length,
|
|
70
|
+
s = new Float64Array(2 * n);
|
|
71
|
+
for (let l = 0; l < n; l++) {
|
|
72
|
+
const n = t[l];
|
|
73
|
+
s[2 * l] = i(n), s[2 * l + 1] = e(n);
|
|
74
|
+
}
|
|
75
|
+
return new f(s);
|
|
76
|
+
}
|
|
77
|
+
constructor(t) {
|
|
78
|
+
const i = t.length >> 1;
|
|
79
|
+
if (i > 0 && "number" != typeof t[0]) throw new Error("Expected coords to contain numbers.");
|
|
80
|
+
this.coords = t;
|
|
81
|
+
const e = Math.max(2 * i - 5, 0);
|
|
82
|
+
this._triangles = new Uint32Array(3 * e), this._halfedges = new Int32Array(3 * e), this._hashSize = Math.ceil(Math.sqrt(i)), this._hullPrev = new Uint32Array(i), this._hullNext = new Uint32Array(i), this._hullTri = new Uint32Array(i), this._hullHash = new Int32Array(this._hashSize).fill(-1), this._ids = new Uint32Array(i), this._dists = new Float64Array(i), this.update();
|
|
83
|
+
}
|
|
84
|
+
update() {
|
|
85
|
+
const {
|
|
86
|
+
coords: t,
|
|
87
|
+
_hullPrev: i,
|
|
88
|
+
_hullNext: e,
|
|
89
|
+
_hullTri: n,
|
|
90
|
+
_hullHash: s
|
|
91
|
+
} = this,
|
|
92
|
+
l = t.length >> 1;
|
|
93
|
+
let h = 1 / 0,
|
|
94
|
+
r = 1 / 0,
|
|
95
|
+
o = -1 / 0,
|
|
96
|
+
u = -1 / 0;
|
|
97
|
+
for (let i = 0; i < l; i++) {
|
|
98
|
+
const e = t[2 * i],
|
|
99
|
+
n = t[2 * i + 1];
|
|
100
|
+
e < h && (h = e), n < r && (r = n), e > o && (o = e), n > u && (u = n), this._ids[i] = i;
|
|
101
|
+
}
|
|
102
|
+
const f = (h + o) / 2,
|
|
103
|
+
d = (r + u) / 2;
|
|
104
|
+
let m,
|
|
105
|
+
x,
|
|
106
|
+
p,
|
|
107
|
+
w = 1 / 0;
|
|
108
|
+
for (let i = 0; i < l; i++) {
|
|
109
|
+
const e = _(f, d, t[2 * i], t[2 * i + 1]);
|
|
110
|
+
e < w && (m = i, w = e);
|
|
111
|
+
}
|
|
112
|
+
const v = t[2 * m],
|
|
113
|
+
b = t[2 * m + 1];
|
|
114
|
+
w = 1 / 0;
|
|
115
|
+
for (let i = 0; i < l; i++) {
|
|
116
|
+
if (i === m) continue;
|
|
117
|
+
const e = _(v, b, t[2 * i], t[2 * i + 1]);
|
|
118
|
+
e < w && e > 0 && (x = i, w = e);
|
|
119
|
+
}
|
|
120
|
+
let T = t[2 * x],
|
|
121
|
+
M = t[2 * x + 1],
|
|
122
|
+
A = 1 / 0;
|
|
123
|
+
for (let i = 0; i < l; i++) {
|
|
124
|
+
if (i === m || i === x) continue;
|
|
125
|
+
const e = g(v, b, T, M, t[2 * i], t[2 * i + 1]);
|
|
126
|
+
e < A && (p = i, A = e);
|
|
127
|
+
}
|
|
128
|
+
let k = t[2 * p],
|
|
129
|
+
$ = t[2 * p + 1];
|
|
130
|
+
if (A === 1 / 0) {
|
|
131
|
+
for (let i = 0; i < l; i++) this._dists[i] = t[2 * i] - t[0] || t[2 * i + 1] - t[1];
|
|
132
|
+
y(this._ids, this._dists, 0, l - 1);
|
|
133
|
+
const i = new Uint32Array(l);
|
|
134
|
+
let e = 0;
|
|
135
|
+
for (let t = 0, n = -1 / 0; t < l; t++) {
|
|
136
|
+
const s = this._ids[t];
|
|
137
|
+
this._dists[s] > n && (i[e++] = s, n = this._dists[s]);
|
|
138
|
+
}
|
|
139
|
+
return this.hull = i.subarray(0, e), this.triangles = new Uint32Array(0), void (this.halfedges = new Uint32Array(0));
|
|
140
|
+
}
|
|
141
|
+
if (a(v, b, T, M, k, $) < 0) {
|
|
142
|
+
const t = x,
|
|
143
|
+
i = T,
|
|
144
|
+
e = M;
|
|
145
|
+
x = p, T = k, M = $, p = t, k = i, $ = e;
|
|
146
|
+
}
|
|
147
|
+
const P = function (t, i, e, n, s, l) {
|
|
148
|
+
const h = e - t,
|
|
149
|
+
r = n - i,
|
|
150
|
+
o = s - t,
|
|
151
|
+
a = l - i,
|
|
152
|
+
c = h * h + r * r,
|
|
153
|
+
u = o * o + a * a,
|
|
154
|
+
f = .5 / (h * a - r * o);
|
|
155
|
+
return {
|
|
156
|
+
x: t + (a * c - r * u) * f,
|
|
157
|
+
y: i + (h * u - o * c) * f
|
|
158
|
+
};
|
|
159
|
+
}(v, b, T, M, k, $);
|
|
160
|
+
this._cx = P.x, this._cy = P.y;
|
|
161
|
+
for (let i = 0; i < l; i++) this._dists[i] = _(t[2 * i], t[2 * i + 1], P.x, P.y);
|
|
162
|
+
y(this._ids, this._dists, 0, l - 1), this._hullStart = m;
|
|
163
|
+
let S = 3;
|
|
164
|
+
e[m] = i[p] = x, e[x] = i[m] = p, e[p] = i[x] = m, n[m] = 0, n[x] = 1, n[p] = 2, s.fill(-1), s[this._hashKey(v, b)] = m, s[this._hashKey(T, M)] = x, s[this._hashKey(k, $)] = p, this.trianglesLen = 0, this._addTriangle(m, x, p, -1, -1, -1);
|
|
165
|
+
for (let l, h, r = 0; r < this._ids.length; r++) {
|
|
166
|
+
const o = this._ids[r],
|
|
167
|
+
u = t[2 * o],
|
|
168
|
+
f = t[2 * o + 1];
|
|
169
|
+
if (r > 0 && Math.abs(u - l) <= c && Math.abs(f - h) <= c) continue;
|
|
170
|
+
if (l = u, h = f, o === m || o === x || o === p) continue;
|
|
171
|
+
let _ = 0;
|
|
172
|
+
for (let t = 0, i = this._hashKey(u, f); t < this._hashSize && (_ = s[(i + t) % this._hashSize], -1 === _ || _ === e[_]); t++);
|
|
173
|
+
_ = i[_];
|
|
174
|
+
let d,
|
|
175
|
+
g = _;
|
|
176
|
+
for (; d = e[g], a(u, f, t[2 * g], t[2 * g + 1], t[2 * d], t[2 * d + 1]) >= 0;) if (g = d, g === _) {
|
|
177
|
+
g = -1;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
if (-1 === g) continue;
|
|
181
|
+
let y = this._addTriangle(g, o, e[g], -1, -1, n[g]);
|
|
182
|
+
n[o] = this._legalize(y + 2), n[g] = y, S++;
|
|
183
|
+
let w = e[g];
|
|
184
|
+
for (; d = e[w], a(u, f, t[2 * w], t[2 * w + 1], t[2 * d], t[2 * d + 1]) < 0;) y = this._addTriangle(w, o, d, n[o], -1, n[w]), n[o] = this._legalize(y + 2), e[w] = w, S--, w = d;
|
|
185
|
+
if (g === _) for (; d = i[g], a(u, f, t[2 * d], t[2 * d + 1], t[2 * g], t[2 * g + 1]) < 0;) y = this._addTriangle(d, o, g, -1, n[g], n[d]), this._legalize(y + 2), n[d] = y, e[g] = g, S--, g = d;
|
|
186
|
+
this._hullStart = i[o] = g, e[g] = i[w] = o, e[o] = w, s[this._hashKey(u, f)] = o, s[this._hashKey(t[2 * g], t[2 * g + 1])] = g;
|
|
187
|
+
}
|
|
188
|
+
this.hull = new Uint32Array(S);
|
|
189
|
+
for (let t = 0, i = this._hullStart; t < S; t++) this.hull[t] = i, i = e[i];
|
|
190
|
+
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
191
|
+
}
|
|
192
|
+
_hashKey(t, i) {
|
|
193
|
+
return Math.floor(function (t, i) {
|
|
194
|
+
const e = t / (Math.abs(t) + Math.abs(i));
|
|
195
|
+
return (i > 0 ? 3 - e : 1 + e) / 4;
|
|
196
|
+
}(t - this._cx, i - this._cy) * this._hashSize) % this._hashSize;
|
|
197
|
+
}
|
|
198
|
+
_legalize(t) {
|
|
199
|
+
const {
|
|
200
|
+
_triangles: i,
|
|
201
|
+
_halfedges: e,
|
|
202
|
+
coords: n
|
|
203
|
+
} = this;
|
|
204
|
+
let s = 0,
|
|
205
|
+
l = 0;
|
|
206
|
+
for (;;) {
|
|
207
|
+
const h = e[t],
|
|
208
|
+
r = t - t % 3;
|
|
209
|
+
if (l = r + (t + 2) % 3, -1 === h) {
|
|
210
|
+
if (0 === s) break;
|
|
211
|
+
t = u[--s];
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const o = h - h % 3,
|
|
215
|
+
a = r + (t + 1) % 3,
|
|
216
|
+
c = o + (h + 2) % 3,
|
|
217
|
+
f = i[l],
|
|
218
|
+
_ = i[t],
|
|
219
|
+
g = i[a],
|
|
220
|
+
y = i[c];
|
|
221
|
+
if (d(n[2 * f], n[2 * f + 1], n[2 * _], n[2 * _ + 1], n[2 * g], n[2 * g + 1], n[2 * y], n[2 * y + 1])) {
|
|
222
|
+
i[t] = y, i[h] = f;
|
|
223
|
+
const n = e[c];
|
|
224
|
+
if (-1 === n) {
|
|
225
|
+
let i = this._hullStart;
|
|
226
|
+
do {
|
|
227
|
+
if (this._hullTri[i] === c) {
|
|
228
|
+
this._hullTri[i] = t;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
i = this._hullPrev[i];
|
|
232
|
+
} while (i !== this._hullStart);
|
|
233
|
+
}
|
|
234
|
+
this._link(t, n), this._link(h, e[l]), this._link(l, c);
|
|
235
|
+
const r = o + (h + 1) % 3;
|
|
236
|
+
s < u.length && (u[s++] = r);
|
|
237
|
+
} else {
|
|
238
|
+
if (0 === s) break;
|
|
239
|
+
t = u[--s];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return l;
|
|
243
|
+
}
|
|
244
|
+
_link(t, i) {
|
|
245
|
+
this._halfedges[t] = i, -1 !== i && (this._halfedges[i] = t);
|
|
246
|
+
}
|
|
247
|
+
_addTriangle(t, i, e, n, s, l) {
|
|
248
|
+
const h = this.trianglesLen;
|
|
249
|
+
return this._triangles[h] = t, this._triangles[h + 1] = i, this._triangles[h + 2] = e, this._link(h, n), this._link(h + 1, s), this._link(h + 2, l), this.trianglesLen += 3, h;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function _(t, i, e, n) {
|
|
253
|
+
const s = t - e,
|
|
254
|
+
l = i - n;
|
|
255
|
+
return s * s + l * l;
|
|
256
|
+
}
|
|
257
|
+
function d(t, i, e, n, s, l, h, r) {
|
|
258
|
+
const o = t - h,
|
|
259
|
+
a = i - r,
|
|
260
|
+
c = e - h,
|
|
261
|
+
u = n - r,
|
|
262
|
+
f = s - h,
|
|
263
|
+
_ = l - r,
|
|
264
|
+
d = c * c + u * u,
|
|
265
|
+
g = f * f + _ * _;
|
|
266
|
+
return o * (u * g - d * _) - a * (c * g - d * f) + (o * o + a * a) * (c * _ - u * f) < 0;
|
|
267
|
+
}
|
|
268
|
+
function g(t, i, e, n, s, l) {
|
|
269
|
+
const h = e - t,
|
|
270
|
+
r = n - i,
|
|
271
|
+
o = s - t,
|
|
272
|
+
a = l - i,
|
|
273
|
+
c = h * h + r * r,
|
|
274
|
+
u = o * o + a * a,
|
|
275
|
+
f = .5 / (h * a - r * o),
|
|
276
|
+
_ = (a * c - r * u) * f,
|
|
277
|
+
d = (h * u - o * c) * f;
|
|
278
|
+
return _ * _ + d * d;
|
|
279
|
+
}
|
|
280
|
+
function y(t, i, e, n) {
|
|
281
|
+
if (n - e <= 20) for (let s = e + 1; s <= n; s++) {
|
|
282
|
+
const n = t[s],
|
|
283
|
+
l = i[n];
|
|
284
|
+
let h = s - 1;
|
|
285
|
+
for (; h >= e && i[t[h]] > l;) t[h + 1] = t[h--];
|
|
286
|
+
t[h + 1] = n;
|
|
287
|
+
} else {
|
|
288
|
+
let s = e + 1,
|
|
289
|
+
l = n;
|
|
290
|
+
m(t, e + n >> 1, s), i[t[e]] > i[t[n]] && m(t, e, n), i[t[s]] > i[t[n]] && m(t, s, n), i[t[e]] > i[t[s]] && m(t, e, s);
|
|
291
|
+
const h = t[s],
|
|
292
|
+
r = i[h];
|
|
293
|
+
for (;;) {
|
|
294
|
+
do {
|
|
295
|
+
s++;
|
|
296
|
+
} while (i[t[s]] < r);
|
|
297
|
+
do {
|
|
298
|
+
l--;
|
|
299
|
+
} while (i[t[l]] > r);
|
|
300
|
+
if (l < s) break;
|
|
301
|
+
m(t, s, l);
|
|
302
|
+
}
|
|
303
|
+
t[e + 1] = t[l], t[l] = h, n - s + 1 >= l - e ? (y(t, i, s, n), y(t, i, e, l - 1)) : (y(t, i, e, l - 1), y(t, i, s, n));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function m(t, i, e) {
|
|
307
|
+
const n = t[i];
|
|
308
|
+
t[i] = t[e], t[e] = n;
|
|
309
|
+
}
|
|
310
|
+
function x(t) {
|
|
311
|
+
return t[0];
|
|
312
|
+
}
|
|
313
|
+
function p(t) {
|
|
314
|
+
return t[1];
|
|
315
|
+
}
|
|
316
|
+
const w = 1e-6;
|
|
317
|
+
class v {
|
|
318
|
+
constructor() {
|
|
319
|
+
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
|
|
320
|
+
}
|
|
321
|
+
moveTo(t, i) {
|
|
322
|
+
this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +i}`;
|
|
323
|
+
}
|
|
324
|
+
closePath() {
|
|
325
|
+
null !== this._x1 && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
|
|
326
|
+
}
|
|
327
|
+
lineTo(t, i) {
|
|
328
|
+
this._ += `L${this._x1 = +t},${this._y1 = +i}`;
|
|
329
|
+
}
|
|
330
|
+
arc(t, i, e) {
|
|
331
|
+
const n = (t = +t) + (e = +e),
|
|
332
|
+
s = i = +i;
|
|
333
|
+
if (e < 0) throw new Error("negative radius");
|
|
334
|
+
null === this._x1 ? this._ += `M${n},${s}` : (Math.abs(this._x1 - n) > w || Math.abs(this._y1 - s) > w) && (this._ += "L" + n + "," + s), e && (this._ += `A${e},${e},0,1,1,${t - e},${i}A${e},${e},0,1,1,${this._x1 = n},${this._y1 = s}`);
|
|
335
|
+
}
|
|
336
|
+
rect(t, i, e, n) {
|
|
337
|
+
this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +i}h${+e}v${+n}h${-e}Z`;
|
|
338
|
+
}
|
|
339
|
+
value() {
|
|
340
|
+
return this._ || null;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
class b {
|
|
344
|
+
constructor() {
|
|
345
|
+
this._ = [];
|
|
346
|
+
}
|
|
347
|
+
moveTo(t, i) {
|
|
348
|
+
this._.push([t, i]);
|
|
349
|
+
}
|
|
350
|
+
closePath() {
|
|
351
|
+
this._.push(this._[0].slice());
|
|
352
|
+
}
|
|
353
|
+
lineTo(t, i) {
|
|
354
|
+
this._.push([t, i]);
|
|
355
|
+
}
|
|
356
|
+
value() {
|
|
357
|
+
return this._.length ? this._ : null;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
class T {
|
|
361
|
+
constructor(t, [i, e, n, s] = [0, 0, 960, 500]) {
|
|
362
|
+
if (!((n = +n) >= (i = +i) && (s = +s) >= (e = +e))) throw new Error("invalid bounds");
|
|
363
|
+
this.delaunay = t, this._circumcenters = new Float64Array(2 * t.points.length), this.vectors = new Float64Array(2 * t.points.length), this.xmax = n, this.xmin = i, this.ymax = s, this.ymin = e, this._init();
|
|
364
|
+
}
|
|
365
|
+
update() {
|
|
366
|
+
return this.delaunay.update(), this._init(), this;
|
|
367
|
+
}
|
|
368
|
+
_init() {
|
|
369
|
+
const {
|
|
370
|
+
delaunay: {
|
|
371
|
+
points: t,
|
|
372
|
+
hull: i,
|
|
373
|
+
triangles: e
|
|
374
|
+
},
|
|
375
|
+
vectors: n
|
|
376
|
+
} = this;
|
|
377
|
+
let s, l;
|
|
378
|
+
const h = this.circumcenters = this._circumcenters.subarray(0, e.length / 3 * 2);
|
|
379
|
+
for (let n, r, o = 0, a = 0, c = e.length; o < c; o += 3, a += 2) {
|
|
380
|
+
const c = 2 * e[o],
|
|
381
|
+
u = 2 * e[o + 1],
|
|
382
|
+
f = 2 * e[o + 2],
|
|
383
|
+
_ = t[c],
|
|
384
|
+
d = t[c + 1],
|
|
385
|
+
g = t[u],
|
|
386
|
+
y = t[u + 1],
|
|
387
|
+
m = t[f],
|
|
388
|
+
x = t[f + 1],
|
|
389
|
+
p = g - _,
|
|
390
|
+
w = y - d,
|
|
391
|
+
v = m - _,
|
|
392
|
+
b = x - d,
|
|
393
|
+
T = 2 * (p * b - w * v);
|
|
394
|
+
if (Math.abs(T) < 1e-9) {
|
|
395
|
+
if (void 0 === s) {
|
|
396
|
+
s = l = 0;
|
|
397
|
+
for (const e of i) s += t[2 * e], l += t[2 * e + 1];
|
|
398
|
+
s /= i.length, l /= i.length;
|
|
399
|
+
}
|
|
400
|
+
const e = 1e9 * Math.sign((s - _) * b - (l - d) * v);
|
|
401
|
+
n = (_ + m) / 2 - e * b, r = (d + x) / 2 + e * v;
|
|
402
|
+
} else {
|
|
403
|
+
const t = 1 / T,
|
|
404
|
+
i = p * p + w * w,
|
|
405
|
+
e = v * v + b * b;
|
|
406
|
+
n = _ + (b * i - w * e) * t, r = d + (p * e - v * i) * t;
|
|
407
|
+
}
|
|
408
|
+
h[a] = n, h[a + 1] = r;
|
|
409
|
+
}
|
|
410
|
+
let r,
|
|
411
|
+
o,
|
|
412
|
+
a,
|
|
413
|
+
c = i[i.length - 1],
|
|
414
|
+
u = 4 * c,
|
|
415
|
+
f = t[2 * c],
|
|
416
|
+
_ = t[2 * c + 1];
|
|
417
|
+
n.fill(0);
|
|
418
|
+
for (let e = 0; e < i.length; ++e) c = i[e], r = u, o = f, a = _, u = 4 * c, f = t[2 * c], _ = t[2 * c + 1], n[r + 2] = n[u] = a - _, n[r + 3] = n[u + 1] = f - o;
|
|
419
|
+
}
|
|
420
|
+
render(t) {
|
|
421
|
+
const i = null == t ? t = new v() : void 0,
|
|
422
|
+
{
|
|
423
|
+
delaunay: {
|
|
424
|
+
halfedges: e,
|
|
425
|
+
inedges: n,
|
|
426
|
+
hull: s
|
|
427
|
+
},
|
|
428
|
+
circumcenters: l,
|
|
429
|
+
vectors: h
|
|
430
|
+
} = this;
|
|
431
|
+
if (s.length <= 1) return null;
|
|
432
|
+
for (let i = 0, n = e.length; i < n; ++i) {
|
|
433
|
+
const n = e[i];
|
|
434
|
+
if (n < i) continue;
|
|
435
|
+
const s = 2 * Math.floor(i / 3),
|
|
436
|
+
h = 2 * Math.floor(n / 3),
|
|
437
|
+
r = l[s],
|
|
438
|
+
o = l[s + 1],
|
|
439
|
+
a = l[h],
|
|
440
|
+
c = l[h + 1];
|
|
441
|
+
this._renderSegment(r, o, a, c, t);
|
|
442
|
+
}
|
|
443
|
+
let r,
|
|
444
|
+
o = s[s.length - 1];
|
|
445
|
+
for (let i = 0; i < s.length; ++i) {
|
|
446
|
+
r = o, o = s[i];
|
|
447
|
+
const e = 2 * Math.floor(n[o] / 3),
|
|
448
|
+
a = l[e],
|
|
449
|
+
c = l[e + 1],
|
|
450
|
+
u = 4 * r,
|
|
451
|
+
f = this._project(a, c, h[u + 2], h[u + 3]);
|
|
452
|
+
f && this._renderSegment(a, c, f[0], f[1], t);
|
|
453
|
+
}
|
|
454
|
+
return i && i.value();
|
|
455
|
+
}
|
|
456
|
+
renderBounds(t) {
|
|
457
|
+
const i = null == t ? t = new v() : void 0;
|
|
458
|
+
return t.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), i && i.value();
|
|
459
|
+
}
|
|
460
|
+
renderCell(t, i) {
|
|
461
|
+
const e = null == i ? i = new v() : void 0,
|
|
462
|
+
n = this._clip(t);
|
|
463
|
+
if (null === n || !n.length) return;
|
|
464
|
+
i.moveTo(n[0], n[1]);
|
|
465
|
+
let s = n.length;
|
|
466
|
+
for (; n[0] === n[s - 2] && n[1] === n[s - 1] && s > 1;) s -= 2;
|
|
467
|
+
for (let t = 2; t < s; t += 2) n[t] === n[t - 2] && n[t + 1] === n[t - 1] || i.lineTo(n[t], n[t + 1]);
|
|
468
|
+
return i.closePath(), e && e.value();
|
|
469
|
+
}
|
|
470
|
+
*cellPolygons() {
|
|
471
|
+
const {
|
|
472
|
+
delaunay: {
|
|
473
|
+
points: t
|
|
474
|
+
}
|
|
475
|
+
} = this;
|
|
476
|
+
for (let i = 0, e = t.length / 2; i < e; ++i) {
|
|
477
|
+
const t = this.cellPolygon(i);
|
|
478
|
+
t && (t.index = i, yield t);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
cellPolygon(t) {
|
|
482
|
+
const i = new b();
|
|
483
|
+
return this.renderCell(t, i), i.value();
|
|
484
|
+
}
|
|
485
|
+
_renderSegment(t, i, e, n, s) {
|
|
486
|
+
let l;
|
|
487
|
+
const h = this._regioncode(t, i),
|
|
488
|
+
r = this._regioncode(e, n);
|
|
489
|
+
0 === h && 0 === r ? (s.moveTo(t, i), s.lineTo(e, n)) : (l = this._clipSegment(t, i, e, n, h, r)) && (s.moveTo(l[0], l[1]), s.lineTo(l[2], l[3]));
|
|
490
|
+
}
|
|
491
|
+
contains(t, i, e) {
|
|
492
|
+
return (i = +i) == i && (e = +e) == e && this.delaunay._step(t, i, e) === t;
|
|
493
|
+
}
|
|
494
|
+
*neighbors(t) {
|
|
495
|
+
const i = this._clip(t);
|
|
496
|
+
if (i) for (const e of this.delaunay.neighbors(t)) {
|
|
497
|
+
const t = this._clip(e);
|
|
498
|
+
if (t) t: for (let n = 0, s = i.length; n < s; n += 2) for (let l = 0, h = t.length; l < h; l += 2) if (i[n] === t[l] && i[n + 1] === t[l + 1] && i[(n + 2) % s] === t[(l + h - 2) % h] && i[(n + 3) % s] === t[(l + h - 1) % h]) {
|
|
499
|
+
yield e;
|
|
500
|
+
break t;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
_cell(t) {
|
|
505
|
+
const {
|
|
506
|
+
circumcenters: i,
|
|
507
|
+
delaunay: {
|
|
508
|
+
inedges: e,
|
|
509
|
+
halfedges: n,
|
|
510
|
+
triangles: s
|
|
511
|
+
}
|
|
512
|
+
} = this,
|
|
513
|
+
l = e[t];
|
|
514
|
+
if (-1 === l) return null;
|
|
515
|
+
const h = [];
|
|
516
|
+
let r = l;
|
|
517
|
+
do {
|
|
518
|
+
const e = Math.floor(r / 3);
|
|
519
|
+
if (h.push(i[2 * e], i[2 * e + 1]), r = r % 3 == 2 ? r - 2 : r + 1, s[r] !== t) break;
|
|
520
|
+
r = n[r];
|
|
521
|
+
} while (r !== l && -1 !== r);
|
|
522
|
+
return h;
|
|
523
|
+
}
|
|
524
|
+
_clip(t) {
|
|
525
|
+
if (0 === t && 1 === this.delaunay.hull.length) return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
|
|
526
|
+
const i = this._cell(t);
|
|
527
|
+
if (null === i) return null;
|
|
528
|
+
const {
|
|
529
|
+
vectors: e
|
|
530
|
+
} = this,
|
|
531
|
+
n = 4 * t;
|
|
532
|
+
return this._simplify(e[n] || e[n + 1] ? this._clipInfinite(t, i, e[n], e[n + 1], e[n + 2], e[n + 3]) : this._clipFinite(t, i));
|
|
533
|
+
}
|
|
534
|
+
_clipFinite(t, i) {
|
|
535
|
+
const e = i.length;
|
|
536
|
+
let n,
|
|
537
|
+
s,
|
|
538
|
+
l,
|
|
539
|
+
h,
|
|
540
|
+
r = null,
|
|
541
|
+
o = i[e - 2],
|
|
542
|
+
a = i[e - 1],
|
|
543
|
+
c = this._regioncode(o, a),
|
|
544
|
+
u = 0;
|
|
545
|
+
for (let f = 0; f < e; f += 2) if (n = o, s = a, o = i[f], a = i[f + 1], l = c, c = this._regioncode(o, a), 0 === l && 0 === c) h = u, u = 0, r ? r.push(o, a) : r = [o, a];else {
|
|
546
|
+
let i, e, f, _, d;
|
|
547
|
+
if (0 === l) {
|
|
548
|
+
if (null === (i = this._clipSegment(n, s, o, a, l, c))) continue;
|
|
549
|
+
[e, f, _, d] = i;
|
|
550
|
+
} else {
|
|
551
|
+
if (null === (i = this._clipSegment(o, a, n, s, c, l))) continue;
|
|
552
|
+
[_, d, e, f] = i, h = u, u = this._edgecode(e, f), h && u && this._edge(t, h, u, r, r.length), r ? r.push(e, f) : r = [e, f];
|
|
553
|
+
}
|
|
554
|
+
h = u, u = this._edgecode(_, d), h && u && this._edge(t, h, u, r, r.length), r ? r.push(_, d) : r = [_, d];
|
|
555
|
+
}
|
|
556
|
+
if (r) h = u, u = this._edgecode(r[0], r[1]), h && u && this._edge(t, h, u, r, r.length);else if (this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
|
|
557
|
+
return r;
|
|
558
|
+
}
|
|
559
|
+
_clipSegment(t, i, e, n, s, l) {
|
|
560
|
+
const h = s < l;
|
|
561
|
+
for (h && ([t, i, e, n, s, l] = [e, n, t, i, l, s]);;) {
|
|
562
|
+
if (0 === s && 0 === l) return h ? [e, n, t, i] : [t, i, e, n];
|
|
563
|
+
if (s & l) return null;
|
|
564
|
+
let r,
|
|
565
|
+
o,
|
|
566
|
+
a = s || l;
|
|
567
|
+
8 & a ? (r = t + (e - t) * (this.ymax - i) / (n - i), o = this.ymax) : 4 & a ? (r = t + (e - t) * (this.ymin - i) / (n - i), o = this.ymin) : 2 & a ? (o = i + (n - i) * (this.xmax - t) / (e - t), r = this.xmax) : (o = i + (n - i) * (this.xmin - t) / (e - t), r = this.xmin), s ? (t = r, i = o, s = this._regioncode(t, i)) : (e = r, n = o, l = this._regioncode(e, n));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
_clipInfinite(t, i, e, n, s, l) {
|
|
571
|
+
let h,
|
|
572
|
+
r = Array.from(i);
|
|
573
|
+
if ((h = this._project(r[0], r[1], e, n)) && r.unshift(h[0], h[1]), (h = this._project(r[r.length - 2], r[r.length - 1], s, l)) && r.push(h[0], h[1]), r = this._clipFinite(t, r)) for (let i, e = 0, n = r.length, s = this._edgecode(r[n - 2], r[n - 1]); e < n; e += 2) i = s, s = this._edgecode(r[e], r[e + 1]), i && s && (e = this._edge(t, i, s, r, e), n = r.length);else this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (r = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]);
|
|
574
|
+
return r;
|
|
575
|
+
}
|
|
576
|
+
_edge(t, i, e, n, s) {
|
|
577
|
+
for (; i !== e;) {
|
|
578
|
+
let e, l;
|
|
579
|
+
switch (i) {
|
|
580
|
+
case 5:
|
|
581
|
+
i = 4;
|
|
582
|
+
continue;
|
|
583
|
+
case 4:
|
|
584
|
+
i = 6, e = this.xmax, l = this.ymin;
|
|
585
|
+
break;
|
|
586
|
+
case 6:
|
|
587
|
+
i = 2;
|
|
588
|
+
continue;
|
|
589
|
+
case 2:
|
|
590
|
+
i = 10, e = this.xmax, l = this.ymax;
|
|
591
|
+
break;
|
|
592
|
+
case 10:
|
|
593
|
+
i = 8;
|
|
594
|
+
continue;
|
|
595
|
+
case 8:
|
|
596
|
+
i = 9, e = this.xmin, l = this.ymax;
|
|
597
|
+
break;
|
|
598
|
+
case 9:
|
|
599
|
+
i = 1;
|
|
600
|
+
continue;
|
|
601
|
+
case 1:
|
|
602
|
+
i = 5, e = this.xmin, l = this.ymin;
|
|
603
|
+
}
|
|
604
|
+
n[s] === e && n[s + 1] === l || !this.contains(t, e, l) || (n.splice(s, 0, e, l), s += 2);
|
|
605
|
+
}
|
|
606
|
+
return s;
|
|
607
|
+
}
|
|
608
|
+
_project(t, i, e, n) {
|
|
609
|
+
let s,
|
|
610
|
+
l,
|
|
611
|
+
h,
|
|
612
|
+
r = 1 / 0;
|
|
613
|
+
if (n < 0) {
|
|
614
|
+
if (i <= this.ymin) return null;
|
|
615
|
+
(s = (this.ymin - i) / n) < r && (h = this.ymin, l = t + (r = s) * e);
|
|
616
|
+
} else if (n > 0) {
|
|
617
|
+
if (i >= this.ymax) return null;
|
|
618
|
+
(s = (this.ymax - i) / n) < r && (h = this.ymax, l = t + (r = s) * e);
|
|
619
|
+
}
|
|
620
|
+
if (e > 0) {
|
|
621
|
+
if (t >= this.xmax) return null;
|
|
622
|
+
(s = (this.xmax - t) / e) < r && (l = this.xmax, h = i + (r = s) * n);
|
|
623
|
+
} else if (e < 0) {
|
|
624
|
+
if (t <= this.xmin) return null;
|
|
625
|
+
(s = (this.xmin - t) / e) < r && (l = this.xmin, h = i + (r = s) * n);
|
|
626
|
+
}
|
|
627
|
+
return [l, h];
|
|
628
|
+
}
|
|
629
|
+
_edgecode(t, i) {
|
|
630
|
+
return (t === this.xmin ? 1 : t === this.xmax ? 2 : 0) | (i === this.ymin ? 4 : i === this.ymax ? 8 : 0);
|
|
631
|
+
}
|
|
632
|
+
_regioncode(t, i) {
|
|
633
|
+
return (t < this.xmin ? 1 : t > this.xmax ? 2 : 0) | (i < this.ymin ? 4 : i > this.ymax ? 8 : 0);
|
|
634
|
+
}
|
|
635
|
+
_simplify(t) {
|
|
636
|
+
if (t && t.length > 4) {
|
|
637
|
+
for (let i = 0; i < t.length; i += 2) {
|
|
638
|
+
const e = (i + 2) % t.length,
|
|
639
|
+
n = (i + 4) % t.length;
|
|
640
|
+
(t[i] === t[e] && t[e] === t[n] || t[i + 1] === t[e + 1] && t[e + 1] === t[n + 1]) && (t.splice(e, 2), i -= 2);
|
|
641
|
+
}
|
|
642
|
+
t.length || (t = null);
|
|
643
|
+
}
|
|
644
|
+
return t;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
const M = 2 * Math.PI,
|
|
648
|
+
A = Math.pow;
|
|
649
|
+
function k(t) {
|
|
650
|
+
return t[0];
|
|
651
|
+
}
|
|
652
|
+
function $(t) {
|
|
653
|
+
return t[1];
|
|
654
|
+
}
|
|
655
|
+
function P(t, i, e) {
|
|
656
|
+
return [t + Math.sin(t + i) * e, i + Math.cos(t - i) * e];
|
|
657
|
+
}
|
|
658
|
+
class S {
|
|
659
|
+
static from(t, i = k, e = $, n) {
|
|
660
|
+
return new S("length" in t ? function (t, i, e, n) {
|
|
661
|
+
const s = t.length,
|
|
662
|
+
l = new Float64Array(2 * s);
|
|
663
|
+
for (let h = 0; h < s; ++h) {
|
|
664
|
+
const s = t[h];
|
|
665
|
+
l[2 * h] = i.call(n, s, h, t), l[2 * h + 1] = e.call(n, s, h, t);
|
|
666
|
+
}
|
|
667
|
+
return l;
|
|
668
|
+
}(t, i, e, n) : Float64Array.from(function* (t, i, e, n) {
|
|
669
|
+
let s = 0;
|
|
670
|
+
for (const l of t) yield i.call(n, l, s, t), yield e.call(n, l, s, t), ++s;
|
|
671
|
+
}(t, i, e, n)));
|
|
672
|
+
}
|
|
673
|
+
constructor(t) {
|
|
674
|
+
this._delaunator = new f(t), this.inedges = new Int32Array(t.length / 2), this._hullIndex = new Int32Array(t.length / 2), this.points = this._delaunator.coords, this._init();
|
|
675
|
+
}
|
|
676
|
+
update() {
|
|
677
|
+
return this._delaunator.update(), this._init(), this;
|
|
678
|
+
}
|
|
679
|
+
_init() {
|
|
680
|
+
const t = this._delaunator,
|
|
681
|
+
i = this.points;
|
|
682
|
+
if (t.hull && t.hull.length > 2 && function (t) {
|
|
683
|
+
const {
|
|
684
|
+
triangles: i,
|
|
685
|
+
coords: e
|
|
686
|
+
} = t;
|
|
687
|
+
for (let t = 0; t < i.length; t += 3) {
|
|
688
|
+
const n = 2 * i[t],
|
|
689
|
+
s = 2 * i[t + 1],
|
|
690
|
+
l = 2 * i[t + 2];
|
|
691
|
+
if ((e[l] - e[n]) * (e[s + 1] - e[n + 1]) - (e[s] - e[n]) * (e[l + 1] - e[n + 1]) > 1e-10) return !1;
|
|
692
|
+
}
|
|
693
|
+
return !0;
|
|
694
|
+
}(t)) {
|
|
695
|
+
this.collinear = Int32Array.from({
|
|
696
|
+
length: i.length / 2
|
|
697
|
+
}, (t, i) => i).sort((t, e) => i[2 * t] - i[2 * e] || i[2 * t + 1] - i[2 * e + 1]);
|
|
698
|
+
const t = this.collinear[0],
|
|
699
|
+
e = this.collinear[this.collinear.length - 1],
|
|
700
|
+
n = [i[2 * t], i[2 * t + 1], i[2 * e], i[2 * e + 1]],
|
|
701
|
+
s = 1e-8 * Math.hypot(n[3] - n[1], n[2] - n[0]);
|
|
702
|
+
for (let t = 0, e = i.length / 2; t < e; ++t) {
|
|
703
|
+
const e = P(i[2 * t], i[2 * t + 1], s);
|
|
704
|
+
i[2 * t] = e[0], i[2 * t + 1] = e[1];
|
|
705
|
+
}
|
|
706
|
+
this._delaunator = new f(i);
|
|
707
|
+
} else delete this.collinear;
|
|
708
|
+
const e = this.halfedges = this._delaunator.halfedges,
|
|
709
|
+
n = this.hull = this._delaunator.hull,
|
|
710
|
+
s = this.triangles = this._delaunator.triangles,
|
|
711
|
+
l = this.inedges.fill(-1),
|
|
712
|
+
h = this._hullIndex.fill(-1);
|
|
713
|
+
for (let t = 0, i = e.length; t < i; ++t) {
|
|
714
|
+
const i = s[t % 3 == 2 ? t - 2 : t + 1];
|
|
715
|
+
-1 !== e[t] && -1 !== l[i] || (l[i] = t);
|
|
716
|
+
}
|
|
717
|
+
for (let t = 0, i = n.length; t < i; ++t) h[n[t]] = t;
|
|
718
|
+
n.length <= 2 && n.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = n[0], l[n[0]] = 1, 2 === n.length && (l[n[1]] = 0, this.triangles[1] = n[1], this.triangles[2] = n[1]));
|
|
719
|
+
}
|
|
720
|
+
voronoi(t) {
|
|
721
|
+
return new T(this, t);
|
|
722
|
+
}
|
|
723
|
+
*neighbors(t) {
|
|
724
|
+
const {
|
|
725
|
+
inedges: i,
|
|
726
|
+
hull: e,
|
|
727
|
+
_hullIndex: n,
|
|
728
|
+
halfedges: s,
|
|
729
|
+
triangles: l,
|
|
730
|
+
collinear: h
|
|
731
|
+
} = this;
|
|
732
|
+
if (h) {
|
|
733
|
+
const i = h.indexOf(t);
|
|
734
|
+
return i > 0 && (yield h[i - 1]), void (i < h.length - 1 && (yield h[i + 1]));
|
|
735
|
+
}
|
|
736
|
+
const r = i[t];
|
|
737
|
+
if (-1 === r) return;
|
|
738
|
+
let o = r,
|
|
739
|
+
a = -1;
|
|
740
|
+
do {
|
|
741
|
+
if (yield a = l[o], o = o % 3 == 2 ? o - 2 : o + 1, l[o] !== t) return;
|
|
742
|
+
if (o = s[o], -1 === o) {
|
|
743
|
+
const i = e[(n[t] + 1) % e.length];
|
|
744
|
+
return void (i !== a && (yield i));
|
|
745
|
+
}
|
|
746
|
+
} while (o !== r);
|
|
747
|
+
}
|
|
748
|
+
find(t, i, e = 0) {
|
|
749
|
+
if ((t = +t) != t || (i = +i) != i) return -1;
|
|
750
|
+
const n = e;
|
|
751
|
+
let s;
|
|
752
|
+
for (; (s = this._step(e, t, i)) >= 0 && s !== e && s !== n;) e = s;
|
|
753
|
+
return s;
|
|
754
|
+
}
|
|
755
|
+
_step(t, i, e) {
|
|
756
|
+
const {
|
|
757
|
+
inedges: n,
|
|
758
|
+
hull: s,
|
|
759
|
+
_hullIndex: l,
|
|
760
|
+
halfedges: h,
|
|
761
|
+
triangles: r,
|
|
762
|
+
points: o
|
|
763
|
+
} = this;
|
|
764
|
+
if (-1 === n[t] || !o.length) return (t + 1) % (o.length >> 1);
|
|
765
|
+
let a = t,
|
|
766
|
+
c = A(i - o[2 * t], 2) + A(e - o[2 * t + 1], 2);
|
|
767
|
+
const u = n[t];
|
|
768
|
+
let f = u;
|
|
769
|
+
do {
|
|
770
|
+
let n = r[f];
|
|
771
|
+
const u = A(i - o[2 * n], 2) + A(e - o[2 * n + 1], 2);
|
|
772
|
+
if (u < c && (c = u, a = n), f = f % 3 == 2 ? f - 2 : f + 1, r[f] !== t) break;
|
|
773
|
+
if (f = h[f], -1 === f) {
|
|
774
|
+
if (f = s[(l[t] + 1) % s.length], f !== n && A(i - o[2 * f], 2) + A(e - o[2 * f + 1], 2) < c) return f;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
} while (f !== u);
|
|
778
|
+
return a;
|
|
779
|
+
}
|
|
780
|
+
render(t) {
|
|
781
|
+
const i = null == t ? t = new v() : void 0,
|
|
782
|
+
{
|
|
783
|
+
points: e,
|
|
784
|
+
halfedges: n,
|
|
785
|
+
triangles: s
|
|
786
|
+
} = this;
|
|
787
|
+
for (let i = 0, l = n.length; i < l; ++i) {
|
|
788
|
+
const l = n[i];
|
|
789
|
+
if (l < i) continue;
|
|
790
|
+
const h = 2 * s[i],
|
|
791
|
+
r = 2 * s[l];
|
|
792
|
+
t.moveTo(e[h], e[h + 1]), t.lineTo(e[r], e[r + 1]);
|
|
793
|
+
}
|
|
794
|
+
return this.renderHull(t), i && i.value();
|
|
795
|
+
}
|
|
796
|
+
renderPoints(t, i) {
|
|
797
|
+
void 0 !== i || t && "function" == typeof t.moveTo || (i = t, t = null), i = null == i ? 2 : +i;
|
|
798
|
+
const e = null == t ? t = new v() : void 0,
|
|
799
|
+
{
|
|
800
|
+
points: n
|
|
801
|
+
} = this;
|
|
802
|
+
for (let e = 0, s = n.length; e < s; e += 2) {
|
|
803
|
+
const s = n[e],
|
|
804
|
+
l = n[e + 1];
|
|
805
|
+
t.moveTo(s + i, l), t.arc(s, l, i, 0, M);
|
|
806
|
+
}
|
|
807
|
+
return e && e.value();
|
|
808
|
+
}
|
|
809
|
+
renderHull(t) {
|
|
810
|
+
const i = null == t ? t = new v() : void 0,
|
|
811
|
+
{
|
|
812
|
+
hull: e,
|
|
813
|
+
points: n
|
|
814
|
+
} = this,
|
|
815
|
+
s = 2 * e[0],
|
|
816
|
+
l = e.length;
|
|
817
|
+
t.moveTo(n[s], n[s + 1]);
|
|
818
|
+
for (let i = 1; i < l; ++i) {
|
|
819
|
+
const s = 2 * e[i];
|
|
820
|
+
t.lineTo(n[s], n[s + 1]);
|
|
821
|
+
}
|
|
822
|
+
return t.closePath(), i && i.value();
|
|
823
|
+
}
|
|
824
|
+
hullPolygon() {
|
|
825
|
+
const t = new b();
|
|
826
|
+
return this.renderHull(t), t.value();
|
|
827
|
+
}
|
|
828
|
+
renderTriangle(t, i) {
|
|
829
|
+
const e = null == i ? i = new v() : void 0,
|
|
830
|
+
{
|
|
831
|
+
points: n,
|
|
832
|
+
triangles: s
|
|
833
|
+
} = this,
|
|
834
|
+
l = 2 * s[t *= 3],
|
|
835
|
+
h = 2 * s[t + 1],
|
|
836
|
+
r = 2 * s[t + 2];
|
|
837
|
+
return i.moveTo(n[l], n[l + 1]), i.lineTo(n[h], n[h + 1]), i.lineTo(n[r], n[r + 1]), i.closePath(), e && e.value();
|
|
838
|
+
}
|
|
839
|
+
*trianglePolygons() {
|
|
840
|
+
const {
|
|
841
|
+
triangles: t
|
|
842
|
+
} = this;
|
|
843
|
+
for (let i = 0, e = t.length / 3; i < e; ++i) yield this.trianglePolygon(i);
|
|
844
|
+
}
|
|
845
|
+
trianglePolygon(t) {
|
|
846
|
+
const i = new b();
|
|
847
|
+
return this.renderTriangle(t, i), i.value();
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
t.Delaunay = S, t.Voronoi = T, Object.defineProperty(t, "__esModule", {
|
|
851
|
+
value: !0
|
|
852
|
+
});
|
|
853
|
+
});
|