@any-touch/vector
Advanced tools
Comparing version 0.6.0-beta.25 to 0.6.0-beta.26
@@ -1,60 +0,1 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var shared = require('@any-touch/shared'); | ||
var angleToRadian = (function (angle) { return angle / 180 * Math.PI; }); | ||
var getVLength = (function (v) { | ||
return Math.sqrt(v.x * v.x + v.y * v.y); | ||
}); | ||
var getDotProduct = (function (v1, v2) { | ||
return v1.x * v2.x + v1.y * v2.y; | ||
}); | ||
var getRadian = (function (v1, v2) { | ||
var mr = getVLength(v1) * getVLength(v2); | ||
if (mr === 0) | ||
return 0; | ||
var r = getDotProduct(v1, v2) / mr; | ||
if (r > 1) | ||
r = 1; | ||
return Math.acos(r); | ||
}); | ||
var getCross = (function (v1, v2) { | ||
return v1.x * v2.y - v2.x * v1.y; | ||
}); | ||
var radianToAngle = (function (radian) { return radian / Math.PI * 180; }); | ||
var getAngle = (function (v1, v2) { | ||
var angle = getRadian(v1, v2); | ||
if (getCross(v1, v2) > 0) { | ||
angle *= -1; | ||
} | ||
return radianToAngle(angle); | ||
}); | ||
var getDirection = (function (x, y) { | ||
if (x === y) { | ||
return shared.NONE; | ||
} | ||
else if (Math.abs(x) > Math.abs(y)) { | ||
return 0 < x ? shared.DIRECTION_RIGHT : shared.DIRECTION_LEFT; | ||
} | ||
else { | ||
return 0 < y ? shared.DIRECTION_DOWN : shared.DIRECTION_UP; | ||
} | ||
}); | ||
exports.angleToRadian = angleToRadian; | ||
exports.getAngle = getAngle; | ||
exports.getCross = getCross; | ||
exports.getDirection = getDirection; | ||
exports.getDotProduct = getDotProduct; | ||
exports.getRadian = getRadian; | ||
exports.getVLength = getVLength; | ||
exports.radianToAngle = radianToAngle; | ||
if (process.env.NODE_ENV === 'development') {module.exports = require('./index.dev.js');} else {module.exports = require('./index.prod.js');} |
{ | ||
"name": "@any-touch/vector", | ||
"version": "0.6.0-beta.25", | ||
"version": "0.6.0-beta.26", | ||
"description": "any-touch中向量计算相关的函数.", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@any-touch/shared": "^0.6.0-beta.25" | ||
"@any-touch/shared": "^0.6.0-beta.26" | ||
}, | ||
@@ -17,3 +17,3 @@ "publishConfig": { | ||
"sideEffects": false, | ||
"gitHead": "e74ad8975c8dcb86eae8f9c1ef2fa43978b96002" | ||
"gitHead": "134804165dc898584f8a8583947da50f5e0e9462" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
9899
24
240
3
2