// npm package
@antv/g-math
Geometry util
versions
158
maintainers
51
license
MIT
first publish
2019-09-27
publisher
wang1212
tarball
274,494 B
AUTO-PUBLISHED·1 version indexed·latest published 2025-12-22
// publisher campaignby wang1212
9 caught packages from this accountThis is not an isolated catch. The same publisher has shipped 8 other packages that our pipeline flagged — the shape of a coordinated campaign, not a one-off. Each link below opens that sibling's analysis.
// offending code· @3.1.0· 1 file flagged
llm: benign · 0.85→ No suspicious destination, no remote-exec shape — 2 known-vendor host(s).
- @3.1.0··AUTO-PUBLISHED·publisher: wang1212heuristic 75/100static flags 1llm benign (0.85) via ollamamature-packageosv-flagged:MAL-2026-3923public-github-push
→ No suspicious destination, no remote-exec shape — 2 known-vendor host(s).
// offending code· 1 file flaggedpatterns: 1
--- package/package.json (excerpt) --- { "name": "@antv/g-math", "version": "3.1.0", "description": "Geometry util", "keywords": [ "antv", "g" ], "homepage": "https://github.com/antvis/g#readme", "bugs": { "url": "https://github.com/antvis/g/issues" }, "repository": { "type": "git", "url": "git+https://github.com/antvis/g.git" }, "license": "MIT", "author": "https://github.com/orgs/antvis/people", "exports": { "types": "./types/index.d.ts", "import": "./dist/index.esm.js", "default": "./dist/index.js" }, "main": "dist/index.js", "unpkg": "dist/index.umd.min.js", "module": "dist/index.esm.js", "types": "types/index.d.ts", "files": [ "package.json", "dist", "types", "LICENSE", "README.md" ], "dependencies": { "@antv/util": "^3.3.5", "@babel/runtime": "^7.25.6", "gl-matrix": "^3.4.3", "tslib": "^2.5.3" }, "publishConfig": { "access": "public" }, "gitHead": "89a517f161e783e64278a4f0d800850db6b5b420", "scripts": { "build:js": "rimraf dist && rollup -c", "build:types": "rimraf types && tsc --emitDeclarationOnly --noCheck", "build": "npm run build:js && npm run build:types", "sync": "tnpm sync", "watch": "rollup -c -w" } } --- package.json (entry) --- { "name": "@antv/g-math", "version": "3.1.0", "description": "Geometry util", "keywords": [ "antv", "g" ], "homepage": "https://github.com/antvis/g#readme", "bugs": { "url": "https://github.com/antvis/g/issues" }, "repository": { "type": "git", "url": "git+https://github.com/antvis/g.git" }, "license": "MIT", "author": "https://github.com/orgs/antvis/people", "exports": { "types": "./types/index.d.ts", "import": "./dist/index.esm.js", "default": "./dist/index.js" }, "main": "dist/index.js", "unpkg": "dist/index.umd.min.js", "module": "dist/index.esm.js", "types": "types/index.d.ts", "files": [ "package.json", "dist", "types", "LICENSE", "README.md" ], "dependencies": { "@antv/util": "^3.3.5", "@babel/runtime": "^7.25.6", "gl-matrix": "^3.4.3", "tslib": "^2.5.3" }, "publishConfig": { "access": "public" }, "gitHead": "89a517f161e783e64278a4f0d800850db6b5b420", "scripts": { "build:js": "rimraf dist && rollup -c", "build:types": "rimraf types && tsc --emitDeclarationOnly --noCheck", "build": "npm run build:js && npm run build:types", "sync": "tnpm --- index.js (entry) --- /*! * @antv/g-math * @description Geometry util * @version 3.1.0 * @date 12/22/2025, 3:02:36 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */ 'use strict'; var _slicedToArray = require('@babel/runtime/helpers/slicedToArray'); var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray'); var util = require('@antv/util'); var glMatrix = require('gl-matrix'); function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } 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)); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function piMod(angle) { return (angle + Math.PI * 2) % (Math.PI * 2); } function copysign(v1, v2) { var absv = Math.abs(v1); return v2 > 0 ? absv : absv * -1; } function nearestPoint$4(x, y, rx, ry, x0, y0) { var a = rx; var b = ry; // 假如椭圆半径为0则返回圆心 if (a === 0 || b === 0) { return { x: x --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- dist/index.esm.js (bundled) --- /*! * @antv/g-math * @description Geometry util * @version 3.1.0 * @date 12/22/2025, 3:02:36 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */ import _slicedToArray from '@babel/runtime/helpers/slicedToArray'; import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray'; import { isNumberEqual } from '@antv/util'; import { vec2 } from 'gl-matrix'; function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } 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)); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function piMod(angle) { return (angle + Math.PI * 2) % (Math.PI * 2); } function copysign(v1, v2) { var absv = Math.abs(v1); return v2 > 0 ? absv : absv * -1; } function nearestPoint$4(x, y, rx, ry, x0, y0) { var a = rx; var b = ry; // 假如椭圆半径为0则返回圆心 if (a === 0 || b === 0) { return { x: x, y: y }; } // 转换成 0, 0 为中心的椭圆计算 var relativeX = x0 - x; var relativeY = y0 - y; var px = Math.abs(relativeX); var py = Math.abs(relativeY); var squareA = a * a; var squareB = b * b; // const angle0 = Math.atan2(relativeY, relativeX); var t = Math.PI / 4; var nearestX = 0; // 椭圆上的任一点 var nearestY = 0; // 迭代 4 次 for (var i = 0; i < 4; i++) { nearestX = a * Math.cos(t); nearestY = b * Math.sin(t); var ex = (squareA - squareB) * Math.pow(Math.cos(t), 3) / a; var ey = (squareB - squareA) * Math.pow(Math.sin(t), 3) / b; var rx1 = nearestX - ex; var ry1 = nearestY - ey; var qx = px - ex; var qy = py - ey; var r = Math.hypot(ry1, rx1); var q = Math.hypot(qy, qx); var delta_c = r * Math.asin((rx1 * qy - ry1 * qx) / (r * q)); v --- dist/index.js (bundled) --- /*! * @antv/g-math * @description Geometry util * @version 3.1.0 * @date 12/22/2025, 3:02:36 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */ 'use strict'; var _slicedToArray = require('@babel/runtime/helpers/slicedToArray'); var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray'); var util = require('@antv/util'); var glMatrix = require('gl-matrix'); function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } 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)); return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }; } function piMod(angle) { return (angle + Math.PI * 2) % (Math.PI * 2); } function copysign(v1, v2) { var absv = Math.abs(v1); return v2 > 0 ? absv : absv * -1; } function nearestPoint$4(x, y, rx, ry, x0, y0) { var a = rx; var b = ry; // 假如椭圆半径为0则返回圆心 if (a === 0 || b === 0) { return { x: x, y: y }; } // 转换成 0, 0 为中心的椭圆计算 var relativeX = x0 - x; var relativeY = y0 - y; var px = Math.abs(relativeX); var py = Math.abs(relativeY); var squareA = a * a; var squareB = b * b; // const angle0 = Math.atan2(relativeY, relativeX); var t = Math.PI / 4; var nearestX = 0; // 椭圆上的任一点 var nearestY = 0; // 迭代 4 次 for (var i = 0; i < 4; i++) { nearestX = a * Math.cos(t); nearestY = b * Math.sin(t); var ex = (squareA - squareB) * Math.pow(Math.cos(t), 3) / a; var ey = (squareB - squareA) * Math.pow(Math.sin(t), 3) / b; var rx1 = nearestX - ex; var ry1 = nearestY - ey; var qx = px - ex; var qy = py - ey; var r = Math.hypot(ry1, rx1); var q = Math.hypot(qy, qx); var delta_c = r * Math.asin((rx1 * qy - ry1 * qx) / ( --- dist/index.umd.min.js (bundled) --- /*! * @antv/g-math * @description Geometry util * @version 3.1.0 * @date 12/22/2025, 3:02:36 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self).G=n.G||{},n.G.Math={}))}(this,function(n){"use strict";function t(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,a=Array(t);t>r;r++)a[r]=n[r];return a}function r(n,r){if(n){if("string"==typeof n)return t(n,r);var a={}.toString.call(n).slice(8,-1);return"Object"===a&&n.constructor&&(a=n.constructor.name),"Map"===a||"Set"===a?Array.from(n):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?t(n,r):void 0}}function a(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var r=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=r){var a,e,o,u,i=[],c=!0,f=!1;try{if(o=(r=r.call(n)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(a=o.call(r)).done)&&(i.push(a.value),i.length!==t);c=!0);}catch(n){f=!0,e=n}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw e}}return i}}(n,t)||r(n,t)||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 e(n){return function(n){if(Array.isArray(n))return t(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||r(n)||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 o(n,t,r,a){var e=n-r,o=t-a;return Math.sqrt(e*e+o*o)}function u(n,t){var r=Math.min.apply(Math,e(n)),a=Math.min.apply(Math,e(t));return{x:r,y:a,width:Math.max.apply(Math,e(n))-r,height:Math.
