NuclearDispersionSystem/ant-design-vue-jeecg/node_modules/viser/es/utils/MathUtils.js
2023-09-14 14:47:11 +08:00

15 lines
508 B
Java

export var calculateUnitNormal = function (vector) {
var _a = vector[0], a = _a === void 0 ? 0 : _a, _b = vector[1], b = _b === void 0 ? 0 : _b;
var magnitud = Math.pow(a, 2) + Math.pow(b, 2);
if (magnitud <= 0) {
return [0, 0];
}
if (a === 0) {
return [1, 0];
}
var tanTheta = b / a;
var theta = Math.atan(tanTheta);
var normalTheta = theta + Math.PI / 2;
return [Math.cos(normalTheta), Math.sin(normalTheta)];
};
//# sourceMappingURL=MathUtils.js.map