d3plus-shape
Version:
Fancy SVG shapes for visualizations
12 lines (11 loc) • 452 B
JavaScript
import pointDistanceSquared from "./pointDistanceSquared.js";
/**
@function pointDistance
@desc Calculates the pixel distance between two points.
@param {Array} p1 The first point, which should always be an `[x, y]` formatted Array.
@param {Array} p2 The second point, which should always be an `[x, y]` formatted Array.
@returns {Number}
*/
export default (function (p1, p2) {
return Math.sqrt(pointDistanceSquared(p1, p2));
});