@antv/g-math
Advanced tools
Comparing version 1.7.47 to 1.7.48
import { vec2 } from 'gl-matrix'; | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
/** | ||
@@ -82,6 +20,6 @@ * 两点之间的距离 | ||
function getBBoxByArray(xArr, yArr) { | ||
var minX = Math.min.apply(Math, _toConsumableArray(xArr)); | ||
var minY = Math.min.apply(Math, _toConsumableArray(yArr)); | ||
var maxX = Math.max.apply(Math, _toConsumableArray(xArr)); | ||
var maxY = Math.max.apply(Math, _toConsumableArray(yArr)); | ||
var minX = Math.min.apply(Math, xArr); | ||
var minY = Math.min.apply(Math, yArr); | ||
var maxX = Math.max.apply(Math, xArr); | ||
var maxY = Math.max.apply(Math, yArr); | ||
return { | ||
@@ -231,3 +169,3 @@ x: minX, | ||
var _t = i * increaseRate; | ||
var v1 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([_t]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([_t])))]; | ||
var v1 = [tCallback.apply(void 0, xArr.concat([_t])), tCallback.apply(void 0, yArr.concat([_t]))]; | ||
var d1 = distance(v0[0], v0[1], v1[0], v1[1]); | ||
@@ -260,3 +198,3 @@ if (d1 < d) { | ||
var next = t + interval; | ||
var _v = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([prev]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([prev])))]; | ||
var _v = [tCallback.apply(void 0, xArr.concat([prev])), tCallback.apply(void 0, yArr.concat([prev]))]; | ||
var _d = distance(v0[0], v0[1], _v[0], _v[1]); | ||
@@ -267,3 +205,3 @@ if (prev >= 0 && _d < d) { | ||
} else { | ||
var v2 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([next]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([next])))]; | ||
var v2 = [tCallback.apply(void 0, xArr.concat([next])), tCallback.apply(void 0, yArr.concat([next]))]; | ||
var d2 = distance(v0[0], v0[1], v2[0], v2[1]); | ||
@@ -279,4 +217,4 @@ if (next <= 1 && d2 < d) { | ||
return { | ||
x: tCallback.apply(void 0, _toConsumableArray(xArr.concat([t]))), | ||
y: tCallback.apply(void 0, _toConsumableArray(yArr.concat([t]))) | ||
x: tCallback.apply(void 0, xArr.concat([t])), | ||
y: tCallback.apply(void 0, yArr.concat([t])) | ||
}; | ||
@@ -339,3 +277,3 @@ } | ||
right.push(iterationCount - 1); | ||
return quadraticLength.apply(void 0, _toConsumableArray(left)) + quadraticLength.apply(void 0, _toConsumableArray(right)); | ||
return quadraticLength.apply(void 0, left) + quadraticLength.apply(void 0, right); | ||
} | ||
@@ -445,5 +383,5 @@ var quadratic = { | ||
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); | ||
var left = [].concat(_toConsumableArray(cubics[0]), [iterationCount - 1]); | ||
var right = [].concat(_toConsumableArray(cubics[1]), [iterationCount - 1]); | ||
return cubicLength.apply(void 0, _toConsumableArray(left)) + cubicLength.apply(void 0, _toConsumableArray(right)); | ||
var left = [].concat(cubics[0], [iterationCount - 1]); | ||
var right = [].concat(cubics[1], [iterationCount - 1]); | ||
return cubicLength.apply(void 0, left) + cubicLength.apply(void 0, right); | ||
} | ||
@@ -778,5 +716,4 @@ var cubic = { | ||
var relativeVector = rotate(x0 - cx, y0 - cy, -xRotation); | ||
var _relativeVector = _slicedToArray(relativeVector, 2), | ||
x1 = _relativeVector[0], | ||
y1 = _relativeVector[1]; | ||
var x1 = relativeVector[0], | ||
y1 = relativeVector[1]; | ||
// 计算点到椭圆的最近的点 | ||
@@ -783,0 +720,0 @@ var relativePoint = ellipse.nearestPoint(0, 0, rx, ry, x1, y1); |
@@ -7,64 +7,2 @@ 'use strict'; | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
/** | ||
@@ -87,6 +25,6 @@ * 两点之间的距离 | ||
function getBBoxByArray(xArr, yArr) { | ||
var minX = Math.min.apply(Math, _toConsumableArray(xArr)); | ||
var minY = Math.min.apply(Math, _toConsumableArray(yArr)); | ||
var maxX = Math.max.apply(Math, _toConsumableArray(xArr)); | ||
var maxY = Math.max.apply(Math, _toConsumableArray(yArr)); | ||
var minX = Math.min.apply(Math, xArr); | ||
var minY = Math.min.apply(Math, yArr); | ||
var maxX = Math.max.apply(Math, xArr); | ||
var maxY = Math.max.apply(Math, yArr); | ||
return { | ||
@@ -236,3 +174,3 @@ x: minX, | ||
var _t = i * increaseRate; | ||
var v1 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([_t]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([_t])))]; | ||
var v1 = [tCallback.apply(void 0, xArr.concat([_t])), tCallback.apply(void 0, yArr.concat([_t]))]; | ||
var d1 = distance(v0[0], v0[1], v1[0], v1[1]); | ||
@@ -265,3 +203,3 @@ if (d1 < d) { | ||
var next = t + interval; | ||
var _v = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([prev]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([prev])))]; | ||
var _v = [tCallback.apply(void 0, xArr.concat([prev])), tCallback.apply(void 0, yArr.concat([prev]))]; | ||
var _d = distance(v0[0], v0[1], _v[0], _v[1]); | ||
@@ -272,3 +210,3 @@ if (prev >= 0 && _d < d) { | ||
} else { | ||
var v2 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([next]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([next])))]; | ||
var v2 = [tCallback.apply(void 0, xArr.concat([next])), tCallback.apply(void 0, yArr.concat([next]))]; | ||
var d2 = distance(v0[0], v0[1], v2[0], v2[1]); | ||
@@ -284,4 +222,4 @@ if (next <= 1 && d2 < d) { | ||
return { | ||
x: tCallback.apply(void 0, _toConsumableArray(xArr.concat([t]))), | ||
y: tCallback.apply(void 0, _toConsumableArray(yArr.concat([t]))) | ||
x: tCallback.apply(void 0, xArr.concat([t])), | ||
y: tCallback.apply(void 0, yArr.concat([t])) | ||
}; | ||
@@ -344,3 +282,3 @@ } | ||
right.push(iterationCount - 1); | ||
return quadraticLength.apply(void 0, _toConsumableArray(left)) + quadraticLength.apply(void 0, _toConsumableArray(right)); | ||
return quadraticLength.apply(void 0, left) + quadraticLength.apply(void 0, right); | ||
} | ||
@@ -450,5 +388,5 @@ var quadratic = { | ||
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); | ||
var left = [].concat(_toConsumableArray(cubics[0]), [iterationCount - 1]); | ||
var right = [].concat(_toConsumableArray(cubics[1]), [iterationCount - 1]); | ||
return cubicLength.apply(void 0, _toConsumableArray(left)) + cubicLength.apply(void 0, _toConsumableArray(right)); | ||
var left = [].concat(cubics[0], [iterationCount - 1]); | ||
var right = [].concat(cubics[1], [iterationCount - 1]); | ||
return cubicLength.apply(void 0, left) + cubicLength.apply(void 0, right); | ||
} | ||
@@ -783,5 +721,4 @@ var cubic = { | ||
var relativeVector = rotate(x0 - cx, y0 - cy, -xRotation); | ||
var _relativeVector = _slicedToArray(relativeVector, 2), | ||
x1 = _relativeVector[0], | ||
y1 = _relativeVector[1]; | ||
var x1 = relativeVector[0], | ||
y1 = relativeVector[1]; | ||
// 计算点到椭圆的最近的点 | ||
@@ -788,0 +725,0 @@ var relativePoint = ellipse.nearestPoint(0, 0, rx, ry, x1, y1); |
@@ -7,64 +7,2 @@ (function (global, factory) { | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
/** | ||
@@ -87,6 +25,6 @@ * 两点之间的距离 | ||
function getBBoxByArray(xArr, yArr) { | ||
var minX = Math.min.apply(Math, _toConsumableArray(xArr)); | ||
var minY = Math.min.apply(Math, _toConsumableArray(yArr)); | ||
var maxX = Math.max.apply(Math, _toConsumableArray(xArr)); | ||
var maxY = Math.max.apply(Math, _toConsumableArray(yArr)); | ||
var minX = Math.min.apply(Math, xArr); | ||
var minY = Math.min.apply(Math, yArr); | ||
var maxX = Math.max.apply(Math, xArr); | ||
var maxY = Math.max.apply(Math, yArr); | ||
return { | ||
@@ -361,3 +299,3 @@ x: minX, | ||
var _t = i * increaseRate; | ||
var v1 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([_t]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([_t])))]; | ||
var v1 = [tCallback.apply(void 0, xArr.concat([_t])), tCallback.apply(void 0, yArr.concat([_t]))]; | ||
var d1 = distance(v0[0], v0[1], v1[0], v1[1]); | ||
@@ -390,3 +328,3 @@ if (d1 < d) { | ||
var next = t + interval; | ||
var _v = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([prev]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([prev])))]; | ||
var _v = [tCallback.apply(void 0, xArr.concat([prev])), tCallback.apply(void 0, yArr.concat([prev]))]; | ||
var _d = distance(v0[0], v0[1], _v[0], _v[1]); | ||
@@ -397,3 +335,3 @@ if (prev >= 0 && _d < d) { | ||
} else { | ||
var v2 = [tCallback.apply(void 0, _toConsumableArray(xArr.concat([next]))), tCallback.apply(void 0, _toConsumableArray(yArr.concat([next])))]; | ||
var v2 = [tCallback.apply(void 0, xArr.concat([next])), tCallback.apply(void 0, yArr.concat([next]))]; | ||
var d2 = distance(v0[0], v0[1], v2[0], v2[1]); | ||
@@ -409,4 +347,4 @@ if (next <= 1 && d2 < d) { | ||
return { | ||
x: tCallback.apply(void 0, _toConsumableArray(xArr.concat([t]))), | ||
y: tCallback.apply(void 0, _toConsumableArray(yArr.concat([t]))) | ||
x: tCallback.apply(void 0, xArr.concat([t])), | ||
y: tCallback.apply(void 0, yArr.concat([t])) | ||
}; | ||
@@ -469,3 +407,3 @@ } | ||
right.push(iterationCount - 1); | ||
return quadraticLength.apply(void 0, _toConsumableArray(left)) + quadraticLength.apply(void 0, _toConsumableArray(right)); | ||
return quadraticLength.apply(void 0, left) + quadraticLength.apply(void 0, right); | ||
} | ||
@@ -575,5 +513,5 @@ var quadratic = { | ||
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); | ||
var left = [].concat(_toConsumableArray(cubics[0]), [iterationCount - 1]); | ||
var right = [].concat(_toConsumableArray(cubics[1]), [iterationCount - 1]); | ||
return cubicLength.apply(void 0, _toConsumableArray(left)) + cubicLength.apply(void 0, _toConsumableArray(right)); | ||
var left = [].concat(cubics[0], [iterationCount - 1]); | ||
var right = [].concat(cubics[1], [iterationCount - 1]); | ||
return cubicLength.apply(void 0, left) + cubicLength.apply(void 0, right); | ||
} | ||
@@ -908,5 +846,4 @@ var cubic = { | ||
var relativeVector = rotate(x0 - cx, y0 - cy, -xRotation); | ||
var _relativeVector = _slicedToArray(relativeVector, 2), | ||
x1 = _relativeVector[0], | ||
y1 = _relativeVector[1]; | ||
var x1 = relativeVector[0], | ||
y1 = relativeVector[1]; | ||
// 计算点到椭圆的最近的点 | ||
@@ -913,0 +850,0 @@ var relativePoint = ellipse.nearestPoint(0, 0, rx, ry, x1, y1); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Math={}))}(this,(function(t){"use strict";function n(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var a,e,o,i,u=[],f=!0,h=!1;try{if(o=(r=r.call(t)).next,0===n){if(Object(r)!==r)return;f=!1}else for(;!(f=(a=o.call(r)).done)&&(u.push(a.value),u.length!==n);f=!0);}catch(t){h=!0,e=t}finally{try{if(!f&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw e}}return u}}(t,n)||a(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function e(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,a=Array(n);n>r;r++)a[r]=t[r];return a}function o(t,n,r,a){var e=t-r,o=n-a;return Math.sqrt(e*e+o*o)}function i(t,n){return.001>Math.abs(t-n)}function u(t,n){var a=Math.min.apply(Math,r(t)),e=Math.min.apply(Math,r(n));return{x:a,y:e,width:Math.max.apply(Math,r(t))-a,height:Math.max.apply(Math,r(n))-e}}function f(t){return(t+2*Math.PI)%(2*Math.PI)}var h=Object.freeze({__proto__:null,distance:o,isNumberEqual:i,getBBoxByArray:u,getBBoxRange:function(t,n,r,a){return{minX:Math.min(t,r),maxX:Math.max(t,r),minY:Math.min(n,a),maxY:Math.max(n,a)}},piMod:f}),c="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});l=new c(2),c!=Float32Array&&(l[0]=0,l[1]=0),s=l;var l,s,p={box:function(t,n,r,a){return u([t,r],[n,a])},length:function(t,n,r,a){return o(t,n,r,a)},pointAt:function(t,n,r,a,e){return{x:(1-e)*t+e*r,y:(1-e)*n+e*a}},pointDistance:function(t,n,r,a,e,i){var u=(r-t)*(e-t)+(a-n)*(i-n);return 0>u?o(t,n,e,i):u>(r-t)*(r-t)+(a-n)*(a-n)?o(r,a,e,i):this.pointToLine(t,n,r,a,e,i)},pointToLine:function(t,n,r,a,e,o){var i=[r-t,a-n];if(function(t,n){return t[0]===n[0]&&t[1]===n[1]}(i,[0,0]))return Math.sqrt((e-t)*(e-t)+(o-n)*(o-n));var u=[-i[1],i[0]];return function(t,n){var r=n[0],a=n[1],e=r*r+a*a;e>0&&(e=1/Math.sqrt(e)),t[0]=n[0]*e,t[1]=n[1]*e}(u,u),Math.abs(function(t,n){return t[0]*n[0]+t[1]*n[1]}([e-t,o-n],u))},tangentAngle:function(t,n,r,a){return Math.atan2(a-n,r-t)}};function v(t,n,a,e,i,u){var f=-1,h=1/0,c=[a,e],l=20;u&&u>200&&(l=u/10);for(var s=1/l,p=s/10,v=0;l>=v;v++){var y=v*s,M=[i.apply(void 0,r(t.concat([y]))),i.apply(void 0,r(n.concat([y])))],g=o(c[0],c[1],M[0],M[1]);h>g&&(f=y,h=g)}if(0===f)return{x:t[0],y:n[0]};if(1===f){var d=t.length;return{x:t[d-1],y:n[d-1]}}h=1/0;for(var x=0;32>x&&1e-4<=p;x++){var m=f-p,b=f+p,A=[i.apply(void 0,r(t.concat([m]))),i.apply(void 0,r(n.concat([m])))],P=o(c[0],c[1],A[0],A[1]);if(m>=0&&h>P)f=m,h=P;else{var I=[i.apply(void 0,r(t.concat([b]))),i.apply(void 0,r(n.concat([b])))],w=o(c[0],c[1],I[0],I[1]);1>=b&&h>w?(f=b,h=w):p*=.5}}return{x:i.apply(void 0,r(t.concat([f]))),y:i.apply(void 0,r(n.concat([f])))}}function y(t,n,r,a){var e=1-a;return e*e*t+2*a*e*n+a*a*r}function M(t,n,r){var a=t+r-2*n;if(i(a,0))return[.5];var e=(t-n)/a;return e>1||0>e?[]:[e]}function g(t,n,r,a){return 2*(1-a)*(n-t)+2*a*(r-n)}function d(t,n,r,a,e,o,i){var u=y(t,r,e,i),f=y(n,a,o,i),h=p.pointAt(t,n,r,a,i),c=p.pointAt(r,a,e,o,i);return[[t,n,h.x,h.y,u,f],[u,f,c.x,c.y,e,o]]}function x(t,n,a,e,i,u,f){if(0===f)return(o(t,n,a,e)+o(a,e,i,u)+o(t,n,i,u))/2;var h=d(t,n,a,e,i,u,.5),c=h[0],l=h[1];return c.push(f-1),l.push(f-1),x.apply(void 0,r(c))+x.apply(void 0,r(l))}var m={box:function(t,n,r,a,e,o){var i=M(t,r,e)[0],f=M(n,a,o)[0],h=[t,e],c=[n,o];return void 0!==i&&h.push(y(t,r,e,i)),void 0!==f&&c.push(y(n,a,o,f)),u(h,c)},length:function(t,n,r,a,e,o){return x(t,n,r,a,e,o,3)},nearestPoint:function(t,n,r,a,e,o,i,u){return v([t,r,e],[n,a,o],i,u,y)},pointDistance:function(t,n,r,a,e,i,u,f){var h=this.nearestPoint(t,n,r,a,e,i,u,f);return o(h.x,h.y,u,f)},interpolationAt:y,pointAt:function(t,n,r,a,e,o,i){return{x:y(t,r,e,i),y:y(n,a,o,i)}},divide:function(t,n,r,a,e,o,i){return d(t,n,r,a,e,o,i)},tangentAngle:function(t,n,r,a,e,o,i){var u=g(t,r,e,i),h=g(n,a,o,i);return f(Math.atan2(h,u))}};function b(t,n,r,a,e){var o=1-e;return o*o*o*t+3*n*e*o*o+3*r*e*e*o+a*e*e*e}function A(t,n,r,a,e){var o=1-e;return 3*(o*o*(n-t)+2*o*e*(r-n)+e*e*(a-r))}function P(t,n,r,a){var e,o,u,f=-3*t+9*n-9*r+3*a,h=6*t-12*n+6*r,c=3*n-3*t,l=[];if(i(f,0))i(h,0)||0>(e=-c/h)||e>1||l.push(e);else{var s=h*h-4*f*c;i(s,0)?l.push(-h/(2*f)):s>0&&(o=(-h-(u=Math.sqrt(s)))/(2*f),0>(e=(-h+u)/(2*f))||e>1||l.push(e),0>o||o>1||l.push(o))}return l}function I(t,n,r,a,e,o,i,u,f){var h=b(t,r,e,i,f),c=b(n,a,o,u,f),l=p.pointAt(t,n,r,a,f),s=p.pointAt(r,a,e,o,f),v=p.pointAt(e,o,i,u,f),y=p.pointAt(l.x,l.y,s.x,s.y,f),M=p.pointAt(s.x,s.y,v.x,v.y,f);return[[t,n,l.x,l.y,y.x,y.y,h,c],[h,c,M.x,M.y,v.x,v.y,i,u]]}function w(t,n,a,e,i,u,f,h,c){if(0===c)return function(t,n){for(var r=0,a=t.length,e=0;a>e;e++)r+=o(t[e],n[e],t[(e+1)%a],n[(e+1)%a]);return r/2}([t,a,i,f],[n,e,u,h]);var l=I(t,n,a,e,i,u,f,h,.5),s=[].concat(r(l[0]),[c-1]),p=[].concat(r(l[1]),[c-1]);return w.apply(void 0,r(s))+w.apply(void 0,r(p))}var j={extrema:P,box:function(t,n,r,a,e,o,i,f){for(var h=[t,i],c=[n,f],l=P(t,r,e,i),s=P(n,a,o,f),p=0;l.length>p;p++)h.push(b(t,r,e,i,l[p]));for(var v=0;s.length>v;v++)c.push(b(n,a,o,f,s[v]));return u(h,c)},length:function(t,n,r,a,e,o,i,u){return w(t,n,r,a,e,o,i,u,3)},nearestPoint:function(t,n,r,a,e,o,i,u,f,h,c){return v([t,r,e,i],[n,a,o,u],f,h,b,c)},pointDistance:function(t,n,r,a,e,i,u,f,h,c,l){var s=this.nearestPoint(t,n,r,a,e,i,u,f,h,c,l);return o(s.x,s.y,h,c)},interpolationAt:b,pointAt:function(t,n,r,a,e,o,i,u,f){return{x:b(t,r,e,i,f),y:b(n,a,o,u,f)}},divide:function(t,n,r,a,e,o,i,u,f){return I(t,n,r,a,e,o,i,u,f)},tangentAngle:function(t,n,r,a,e,o,i,u,h){var c=A(t,r,e,i,h),l=A(n,a,o,u,h);return f(Math.atan2(l,c))}};function S(t,n){var r=Math.abs(t);return n>0?r:-1*r}var q=function(t,n,r,a,e,o){var i=r,u=a;if(0===i||0===u)return{x:t,y:n};for(var f=e-t,h=o-n,c=Math.abs(f),l=Math.abs(h),s=i*i,p=u*u,v=Math.PI/4,y=0,M=0,g=0;4>g;g++){y=i*Math.cos(v),M=u*Math.sin(v);var d=(s-p)*Math.pow(Math.cos(v),3)/i,x=(p-s)*Math.pow(Math.sin(v),3)/u,m=y-d,b=M-x,A=c-d,P=l-x,I=Math.hypot(b,m),w=Math.hypot(P,A);v=Math.min(Math.PI/2,Math.max(0,v+=I*Math.asin((m*P-b*A)/(I*w))/Math.sqrt(s+p-y*y-M*M)))}return{x:t+S(y,f),y:n+S(M,h)}};function D(t,n,r,a,e,o){return r*Math.cos(e)*Math.cos(o)-a*Math.sin(e)*Math.sin(o)+t}function L(t,n,r,a,e,o){return r*Math.sin(e)*Math.cos(o)+a*Math.cos(e)*Math.sin(o)+n}function O(t,n,r){return{x:t*Math.cos(r),y:n*Math.sin(r)}}function T(t,n,r){var a=Math.cos(r),e=Math.sin(r);return[t*a-n*e,t*e+n*a]}var _={box:function(t,n,r,a,e,o,i){for(var u=function(t,n,r){return Math.atan(-n/t*Math.tan(r))}(r,a,e),f=1/0,h=-1/0,c=[o,i],l=2*-Math.PI;2*Math.PI>=l;l+=Math.PI){var s=u+l;i>o?s>o&&i>s&&c.push(s):s>i&&o>s&&c.push(s)}for(var p=0;c.length>p;p++){var v=D(t,0,r,a,e,c[p]);f>v&&(f=v),v>h&&(h=v)}for(var y=function(t,n,r){return Math.atan(n/(t*Math.tan(r)))}(r,a,e),M=1/0,g=-1/0,d=[o,i],x=2*-Math.PI;2*Math.PI>=x;x+=Math.PI){var m=y+x;i>o?m>o&&i>m&&d.push(m):m>i&&o>m&&d.push(m)}for(var b=0;d.length>b;b++){var A=L(0,n,r,a,e,d[b]);M>A&&(M=A),A>g&&(g=A)}return{x:f,y:M,width:h-f,height:g-M}},length:function(t,n,r,a,e,o,i){},nearestPoint:function(t,r,a,e,o,i,u,f,h){var c=n(T(f-t,h-r,-o),2),l=q(0,0,a,e,c[0],c[1]),s=function(t,n,r,a){return(Math.atan2(a*t,r*n)+2*Math.PI)%(2*Math.PI)}(a,e,l.x,l.y);i>s?l=O(a,e,i):s>u&&(l=O(a,e,u));var p=T(l.x,l.y,o);return{x:p[0]+t,y:p[1]+r}},pointDistance:function(t,n,r,a,e,i,u,f,h){var c=this.nearestPoint(t,n,r,a,e,i,u,f,h);return o(c.x,c.y,f,h)},pointAt:function(t,n,r,a,e,o,i,u){var f=(i-o)*u+o;return{x:D(t,0,r,a,e,f),y:L(0,n,r,a,e,f)}},tangentAngle:function(t,n,r,a,e,o,i,u){var h=(i-o)*u+o,c=function(t,n,r,a,e,o,i,u){return-1*r*Math.cos(e)*Math.sin(u)-a*Math.sin(e)*Math.cos(u)}(0,0,r,a,e,0,0,h),l=function(t,n,r,a,e,o,i,u){return-1*r*Math.sin(e)*Math.sin(u)+a*Math.cos(e)*Math.cos(u)}(0,0,r,a,e,0,0,h);return f(Math.atan2(l,c))}};function B(t){for(var n=0,r=[],a=0;t.length-1>a;a++){var e=t[a],i=t[a+1],u=o(e[0],e[1],i[0],i[1]);r.push({from:e,to:i,length:u}),n+=u}return{segments:r,totalLength:n}}function E(t){if(2>t.length)return 0;for(var n=0,r=0;t.length-1>r;r++){var a=t[r],e=t[r+1];n+=o(a[0],a[1],e[0],e[1])}return n}function F(t,n){if(n>1||0>n||2>t.length)return null;var r=B(t),a=r.segments,e=r.totalLength;if(0===e)return{x:t[0][0],y:t[0][1]};for(var o=0,i=null,u=0;a.length>u;u++){var f=a[u],h=f.from,c=f.to,l=f.length/e;if(n>=o&&o+l>=n){i=p.pointAt(h[0],h[1],c[0],c[1],(n-o)/l);break}o+=l}return i}function G(t,n){if(n>1||0>n||2>t.length)return 0;for(var r=B(t),a=r.segments,e=r.totalLength,o=0,i=0,u=0;a.length>u;u++){var f=a[u],h=f.from,c=f.to,l=f.length/e;if(n>=o&&o+l>=n){i=Math.atan2(c[1]-h[1],c[0]-h[0]);break}o+=l}return i}function k(t,n,r){for(var a=1/0,e=0;t.length-1>e;e++){var o=t[e],i=t[e+1],u=p.pointDistance(o[0],o[1],i[0],i[1],n,r);a>u&&(a=u)}return a}var C={box:function(t){for(var n=[],r=[],a=0;t.length>a;a++){var e=t[a];n.push(e[0]),r.push(e[1])}return u(n,r)},length:function(t){return E(t)},pointAt:function(t,n){return F(t,n)},pointDistance:function(t,n,r){return k(t,n,r)},tangentAngle:function(t,n){return G(t,n)}};function U(t){var n=t.slice(0);return t.length&&n.push(t[0]),n}var X={box:function(t){return C.box(t)},length:function(t){return E(U(t))},pointAt:function(t,n){return F(U(t),n)},pointDistance:function(t,n,r){return k(U(t),n,r)},tangentAngle:function(t,n){return G(U(t),n)}};t.Arc=_,t.Cubic=j,t.Line=p,t.Polygon=X,t.Polyline=C,t.Quad=m,t.Util=h,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Math={}))}(this,(function(t){"use strict";function n(t,n,r,a){var o=t-r,e=n-a;return Math.sqrt(o*o+e*e)}function r(t,n){return.001>Math.abs(t-n)}function a(t,n){var r=Math.min.apply(Math,t),a=Math.min.apply(Math,n);return{x:r,y:a,width:Math.max.apply(Math,t)-r,height:Math.max.apply(Math,n)-a}}function o(t){return(t+2*Math.PI)%(2*Math.PI)}var e=Object.freeze({__proto__:null,distance:n,isNumberEqual:r,getBBoxByArray:a,getBBoxRange:function(t,n,r,a){return{minX:Math.min(t,r),maxX:Math.max(t,r),minY:Math.min(n,a),maxY:Math.max(n,a)}},piMod:o}),i="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});u=new i(2),i!=Float32Array&&(u[0]=0,u[1]=0),h=u;var u,h,f={box:function(t,n,r,o){return a([t,r],[n,o])},length:function(t,r,a,o){return n(t,r,a,o)},pointAt:function(t,n,r,a,o){return{x:(1-o)*t+o*r,y:(1-o)*n+o*a}},pointDistance:function(t,r,a,o,e,i){var u=(a-t)*(e-t)+(o-r)*(i-r);return 0>u?n(t,r,e,i):u>(a-t)*(a-t)+(o-r)*(o-r)?n(a,o,e,i):this.pointToLine(t,r,a,o,e,i)},pointToLine:function(t,n,r,a,o,e){var i=[r-t,a-n];if(function(t,n){return t[0]===n[0]&&t[1]===n[1]}(i,[0,0]))return Math.sqrt((o-t)*(o-t)+(e-n)*(e-n));var u=[-i[1],i[0]];return function(t,n){var r=n[0],a=n[1],o=r*r+a*a;o>0&&(o=1/Math.sqrt(o)),t[0]=n[0]*o,t[1]=n[1]*o}(u,u),Math.abs(function(t,n){return t[0]*n[0]+t[1]*n[1]}([o-t,e-n],u))},tangentAngle:function(t,n,r,a){return Math.atan2(a-n,r-t)}};function c(t,r,a,o,e,i){var u=-1,h=1/0,f=[a,o],c=20;i&&i>200&&(c=i/10);for(var p=1/c,s=p/10,v=0;c>=v;v++){var M=v*p,l=[e.apply(void 0,t.concat([M])),e.apply(void 0,r.concat([M]))],y=n(f[0],f[1],l[0],l[1]);h>y&&(u=M,h=y)}if(0===u)return{x:t[0],y:r[0]};if(1===u){var g=t.length;return{x:t[g-1],y:r[g-1]}}h=1/0;for(var x=0;32>x&&1e-4<=s;x++){var d=u-s,A=u+s,m=[e.apply(void 0,t.concat([d])),e.apply(void 0,r.concat([d]))],b=n(f[0],f[1],m[0],m[1]);if(d>=0&&h>b)u=d,h=b;else{var P=[e.apply(void 0,t.concat([A])),e.apply(void 0,r.concat([A]))],I=n(f[0],f[1],P[0],P[1]);1>=A&&h>I?(u=A,h=I):s*=.5}}return{x:e.apply(void 0,t.concat([u])),y:e.apply(void 0,r.concat([u]))}}function p(t,n,r,a){var o=1-a;return o*o*t+2*a*o*n+a*a*r}function s(t,n,a){var o=t+a-2*n;if(r(o,0))return[.5];var e=(t-n)/o;return e>1||0>e?[]:[e]}function v(t,n,r,a){return 2*(1-a)*(n-t)+2*a*(r-n)}function M(t,n,r,a,o,e,i){var u=p(t,r,o,i),h=p(n,a,e,i),c=f.pointAt(t,n,r,a,i),s=f.pointAt(r,a,o,e,i);return[[t,n,c.x,c.y,u,h],[u,h,s.x,s.y,o,e]]}function l(t,r,a,o,e,i,u){if(0===u)return(n(t,r,a,o)+n(a,o,e,i)+n(t,r,e,i))/2;var h=M(t,r,a,o,e,i,.5),f=h[0],c=h[1];return f.push(u-1),c.push(u-1),l.apply(void 0,f)+l.apply(void 0,c)}var y={box:function(t,n,r,o,e,i){var u=s(t,r,e)[0],h=s(n,o,i)[0],f=[t,e],c=[n,i];return void 0!==u&&f.push(p(t,r,e,u)),void 0!==h&&c.push(p(n,o,i,h)),a(f,c)},length:function(t,n,r,a,o,e){return l(t,n,r,a,o,e,3)},nearestPoint:function(t,n,r,a,o,e,i,u){return c([t,r,o],[n,a,e],i,u,p)},pointDistance:function(t,r,a,o,e,i,u,h){var f=this.nearestPoint(t,r,a,o,e,i,u,h);return n(f.x,f.y,u,h)},interpolationAt:p,pointAt:function(t,n,r,a,o,e,i){return{x:p(t,r,o,i),y:p(n,a,e,i)}},divide:function(t,n,r,a,o,e,i){return M(t,n,r,a,o,e,i)},tangentAngle:function(t,n,r,a,e,i,u){var h=v(t,r,e,u),f=v(n,a,i,u);return o(Math.atan2(f,h))}};function g(t,n,r,a,o){var e=1-o;return e*e*e*t+3*n*o*e*e+3*r*o*o*e+a*o*o*o}function x(t,n,r,a,o){var e=1-o;return 3*(e*e*(n-t)+2*e*o*(r-n)+o*o*(a-r))}function d(t,n,a,o){var e,i,u,h=-3*t+9*n-9*a+3*o,f=6*t-12*n+6*a,c=3*n-3*t,p=[];if(r(h,0))r(f,0)||0>(e=-c/f)||e>1||p.push(e);else{var s=f*f-4*h*c;r(s,0)?p.push(-f/(2*h)):s>0&&(i=(-f-(u=Math.sqrt(s)))/(2*h),0>(e=(-f+u)/(2*h))||e>1||p.push(e),0>i||i>1||p.push(i))}return p}function A(t,n,r,a,o,e,i,u,h){var c=g(t,r,o,i,h),p=g(n,a,e,u,h),s=f.pointAt(t,n,r,a,h),v=f.pointAt(r,a,o,e,h),M=f.pointAt(o,e,i,u,h),l=f.pointAt(s.x,s.y,v.x,v.y,h),y=f.pointAt(v.x,v.y,M.x,M.y,h);return[[t,n,s.x,s.y,l.x,l.y,c,p],[c,p,y.x,y.y,M.x,M.y,i,u]]}function m(t,r,a,o,e,i,u,h,f){if(0===f)return function(t,r){for(var a=0,o=t.length,e=0;o>e;e++)a+=n(t[e],r[e],t[(e+1)%o],r[(e+1)%o]);return a/2}([t,a,e,u],[r,o,i,h]);var c=A(t,r,a,o,e,i,u,h,.5),p=[].concat(c[0],[f-1]),s=[].concat(c[1],[f-1]);return m.apply(void 0,p)+m.apply(void 0,s)}var b={extrema:d,box:function(t,n,r,o,e,i,u,h){for(var f=[t,u],c=[n,h],p=d(t,r,e,u),s=d(n,o,i,h),v=0;p.length>v;v++)f.push(g(t,r,e,u,p[v]));for(var M=0;s.length>M;M++)c.push(g(n,o,i,h,s[M]));return a(f,c)},length:function(t,n,r,a,o,e,i,u){return m(t,n,r,a,o,e,i,u,3)},nearestPoint:function(t,n,r,a,o,e,i,u,h,f,p){return c([t,r,o,i],[n,a,e,u],h,f,g,p)},pointDistance:function(t,r,a,o,e,i,u,h,f,c,p){var s=this.nearestPoint(t,r,a,o,e,i,u,h,f,c,p);return n(s.x,s.y,f,c)},interpolationAt:g,pointAt:function(t,n,r,a,o,e,i,u,h){return{x:g(t,r,o,i,h),y:g(n,a,e,u,h)}},divide:function(t,n,r,a,o,e,i,u,h){return A(t,n,r,a,o,e,i,u,h)},tangentAngle:function(t,n,r,a,e,i,u,h,f){var c=x(t,r,e,u,f),p=x(n,a,i,h,f);return o(Math.atan2(p,c))}};function P(t,n){var r=Math.abs(t);return n>0?r:-1*r}var I=function(t,n,r,a,o,e){var i=r,u=a;if(0===i||0===u)return{x:t,y:n};for(var h=o-t,f=e-n,c=Math.abs(h),p=Math.abs(f),s=i*i,v=u*u,M=Math.PI/4,l=0,y=0,g=0;4>g;g++){l=i*Math.cos(M),y=u*Math.sin(M);var x=(s-v)*Math.pow(Math.cos(M),3)/i,d=(v-s)*Math.pow(Math.sin(M),3)/u,A=l-x,m=y-d,b=c-x,I=p-d,q=Math.hypot(m,A),D=Math.hypot(I,b);M=Math.min(Math.PI/2,Math.max(0,M+=q*Math.asin((A*I-m*b)/(q*D))/Math.sqrt(s+v-l*l-y*y)))}return{x:t+P(l,h),y:n+P(y,f)}};function q(t,n,r,a,o,e){return r*Math.cos(o)*Math.cos(e)-a*Math.sin(o)*Math.sin(e)+t}function D(t,n,r,a,o,e){return r*Math.sin(o)*Math.cos(e)+a*Math.cos(o)*Math.sin(e)+n}function L(t,n,r){return{x:t*Math.cos(r),y:n*Math.sin(r)}}function _(t,n,r){var a=Math.cos(r),o=Math.sin(r);return[t*a-n*o,t*o+n*a]}var w={box:function(t,n,r,a,o,e,i){for(var u=function(t,n,r){return Math.atan(-n/t*Math.tan(r))}(r,a,o),h=1/0,f=-1/0,c=[e,i],p=2*-Math.PI;2*Math.PI>=p;p+=Math.PI){var s=u+p;i>e?s>e&&i>s&&c.push(s):s>i&&e>s&&c.push(s)}for(var v=0;c.length>v;v++){var M=q(t,0,r,a,o,c[v]);h>M&&(h=M),M>f&&(f=M)}for(var l=function(t,n,r){return Math.atan(n/(t*Math.tan(r)))}(r,a,o),y=1/0,g=-1/0,x=[e,i],d=2*-Math.PI;2*Math.PI>=d;d+=Math.PI){var A=l+d;i>e?A>e&&i>A&&x.push(A):A>i&&e>A&&x.push(A)}for(var m=0;x.length>m;m++){var b=D(0,n,r,a,o,x[m]);y>b&&(y=b),b>g&&(g=b)}return{x:h,y:y,width:f-h,height:g-y}},length:function(t,n,r,a,o,e,i){},nearestPoint:function(t,n,r,a,o,e,i,u,h){var f=_(u-t,h-n,-o),c=I(0,0,r,a,f[0],f[1]),p=function(t,n,r,a){return(Math.atan2(a*t,r*n)+2*Math.PI)%(2*Math.PI)}(r,a,c.x,c.y);e>p?c=L(r,a,e):p>i&&(c=L(r,a,i));var s=_(c.x,c.y,o);return{x:s[0]+t,y:s[1]+n}},pointDistance:function(t,r,a,o,e,i,u,h,f){var c=this.nearestPoint(t,r,a,o,e,i,u,h,f);return n(c.x,c.y,h,f)},pointAt:function(t,n,r,a,o,e,i,u){var h=(i-e)*u+e;return{x:q(t,0,r,a,o,h),y:D(0,n,r,a,o,h)}},tangentAngle:function(t,n,r,a,e,i,u,h){var f=(u-i)*h+i,c=function(t,n,r,a,o,e,i,u){return-1*r*Math.cos(o)*Math.sin(u)-a*Math.sin(o)*Math.cos(u)}(0,0,r,a,e,0,0,f),p=function(t,n,r,a,o,e,i,u){return-1*r*Math.sin(o)*Math.sin(u)+a*Math.cos(o)*Math.cos(u)}(0,0,r,a,e,0,0,f);return o(Math.atan2(p,c))}};function B(t){for(var r=0,a=[],o=0;t.length-1>o;o++){var e=t[o],i=t[o+1],u=n(e[0],e[1],i[0],i[1]);a.push({from:e,to:i,length:u}),r+=u}return{segments:a,totalLength:r}}function T(t){if(2>t.length)return 0;for(var r=0,a=0;t.length-1>a;a++){var o=t[a],e=t[a+1];r+=n(o[0],o[1],e[0],e[1])}return r}function j(t,n){if(n>1||0>n||2>t.length)return null;var r=B(t),a=r.segments,o=r.totalLength;if(0===o)return{x:t[0][0],y:t[0][1]};for(var e=0,i=null,u=0;a.length>u;u++){var h=a[u],c=h.from,p=h.to,s=h.length/o;if(n>=e&&e+s>=n){i=f.pointAt(c[0],c[1],p[0],p[1],(n-e)/s);break}e+=s}return i}function F(t,n){if(n>1||0>n||2>t.length)return 0;for(var r=B(t),a=r.segments,o=r.totalLength,e=0,i=0,u=0;a.length>u;u++){var h=a[u],f=h.from,c=h.to,p=h.length/o;if(n>=e&&e+p>=n){i=Math.atan2(c[1]-f[1],c[0]-f[0]);break}e+=p}return i}function G(t,n,r){for(var a=1/0,o=0;t.length-1>o;o++){var e=t[o],i=t[o+1],u=f.pointDistance(e[0],e[1],i[0],i[1],n,r);a>u&&(a=u)}return a}var k={box:function(t){for(var n=[],r=[],o=0;t.length>o;o++){var e=t[o];n.push(e[0]),r.push(e[1])}return a(n,r)},length:function(t){return T(t)},pointAt:function(t,n){return j(t,n)},pointDistance:function(t,n,r){return G(t,n,r)},tangentAngle:function(t,n){return F(t,n)}};function O(t){var n=t.slice(0);return t.length&&n.push(t[0]),n}var X={box:function(t){return k.box(t)},length:function(t){return T(O(t))},pointAt:function(t,n){return j(O(t),n)},pointDistance:function(t,n,r){return G(O(t),n,r)},tangentAngle:function(t,n){return F(O(t),n)}};t.Arc=w,t.Cubic=b,t.Line=f,t.Polygon=X,t.Polyline=k,t.Quad=y,t.Util=e,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@antv/g-math", | ||
"version": "1.7.47", | ||
"version": "1.7.48", | ||
"description": "Geometry util", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "059286bbeff21a63e75a41811b89623c37f511f4" | ||
"gitHead": "b9efa0d349c3cb699065f407e45f6aa7e0a3336d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136759
3505