You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
58 KiB
JavaScript
25 lines
58 KiB
JavaScript
|
9 months ago
|
"use strict";
|
||
|
|
/*
|
||
|
|
* ATTENTION: An "eval-source-map" devtool has been used.
|
||
|
|
* This devtool is neither made for production nor for readable output files.
|
||
|
|
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
|
||
|
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||
|
|
* or disable the default devtool with "devtool: false".
|
||
|
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||
|
|
*/
|
||
|
|
exports.id = "vendor-chunks/delaunator";
|
||
|
|
exports.ids = ["vendor-chunks/delaunator"];
|
||
|
|
exports.modules = {
|
||
|
|
|
||
|
|
/***/ "(ssr)/./node_modules/delaunator/index.js":
|
||
|
|
/*!******************************************!*\
|
||
|
|
!*** ./node_modules/delaunator/index.js ***!
|
||
|
|
\******************************************/
|
||
|
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
|
|
||
|
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Delaunator)\n/* harmony export */ });\n/* harmony import */ var robust_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! robust-predicates */ \"(ssr)/./node_modules/robust-predicates/index.js\");\nconst EPSILON = Math.pow(2, -52);\nconst EDGE_STACK = new Uint32Array(512);\n\nclass Delaunator {\n static from(points, getX = defaultGetX, getY = defaultGetY) {\n const n = points.length;\n const coords = new Float64Array(n * 2);\n for(let i = 0; i < n; i++){\n const p = points[i];\n coords[2 * i] = getX(p);\n coords[2 * i + 1] = getY(p);\n }\n return new Delaunator(coords);\n }\n constructor(coords){\n const n = coords.length >> 1;\n if (n > 0 && typeof coords[0] !== \"number\") throw new Error(\"Expected coords to contain numbers.\");\n this.coords = coords;\n // arrays that will store the triangulation graph\n const maxTriangles = Math.max(2 * n - 5, 0);\n this._triangles = new Uint32Array(maxTriangles * 3);\n this._halfedges = new Int32Array(maxTriangles * 3);\n // temporary arrays for tracking the edges of the advancing convex hull\n this._hashSize = Math.ceil(Math.sqrt(n));\n this._hullPrev = new Uint32Array(n); // edge to prev edge\n this._hullNext = new Uint32Array(n); // edge to next edge\n this._hullTri = new Uint32Array(n); // edge to adjacent triangle\n this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash\n // temporary arrays for sorting points\n this._ids = new Uint32Array(n);\n this._dists = new Float64Array(n);\n this.update();\n }\n update() {\n const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this;\n const n = coords.length >> 1;\n // populate an array of point indices; calculate input data bbox\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for(let i = 0; i < n; i++){\n const x = coords[2 * i];\n const y = coords[2 * i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n this._ids[i] = i;\n }\n const cx = (minX + maxX) / 2;\n const cy = (minY + maxY) / 2;\n let minDist = Infinity;\n let i0, i1, i2;\n // pick a seed point close to the center\n for(let i = 0; i < n; i++){\n const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist) {\n i0 = i;\n minDist = d;\n }\n }\n const i0x = coords[2 * i0];\n const i0y = coords[2 * i0 + 1];\n minDist = Infinity;\n // find the point closest to the seed\n for(let i = 0; i < n; i++){\n if (i === i0) continue;\n const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);\n if (d < minDist && d > 0) {\n i1 = i;\n minDist = d;\n }\n }\n let i1x = coords[2 * i1];\n let i1y = coords[2 * i1 + 1];\n let minRadius = Infinity;\n // find the third point which forms the smallest circumcircle with the first two\n for(let i = 0; i < n; i++){\n if (i === i0 || i === i1) continue;\n const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]);\n if (r < minRadius) {\n i2 = i;\n minRadius = r;\n }\n }\n let i2x = coords[2 * i2];\n let i2y = coords[2 * i2 + 1];\n if (minRadius === Infinity) {\n // order collinear points by dx (or dy if all x are identical)\n // and return
|
||
|
|
|
||
|
|
/***/ })
|
||
|
|
|
||
|
|
};
|
||
|
|
;
|