Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@any-touch/vector

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@any-touch/vector - npm Package Compare versions

Comparing version 0.6.0-beta.25 to 0.6.0-beta.26

dist/index.dev.js

61

dist/index.js

@@ -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"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc