14 lines
612 B
JavaScript
14 lines
612 B
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$maths$misc$squaredDistanceToLineSegment = function(global, require, module, exports) {
|
|
exports.squaredDistanceToLineSegment = function(x, y, x1, y1, x2, y2) {
|
|
const c = x2 - x1, d = y2 - y1, lenSq = c * c + d * d;
|
|
let param = -1;
|
|
0 !== lenSq && (param = ((x - x1) * c + (y - y1) * d) / lenSq);
|
|
0 > param || (1 < param ? (x1 = x2, y1 = y2) : (x1 += param * c, y1 += param * d));
|
|
x -= x1;
|
|
y -= y1;
|
|
return x * x + y * y;
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$maths$misc$squaredDistanceToLineSegment.js.map
|