line-length.js 457 B

1234567891011121314
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.lineLen = void 0;
  4. var tslib_1 = require("tslib");
  5. /**
  6. * 计算线段长度
  7. */
  8. function lineLen(_a, _b) {
  9. var _c = tslib_1.__read(_a, 2), x1 = _c[0], y1 = _c[1];
  10. var _d = tslib_1.__read(_b, 2), x2 = _d[0], y2 = _d[1];
  11. return Math.pow((Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)), 0.5);
  12. }
  13. exports.lineLen = lineLen;
  14. //# sourceMappingURL=line-length.js.map