@fimbul-works/vec
Version:
A comprehensive TypeScript vector math library providing 2D, 3D, and 4D vector operations with a focus on performance and type safety.
12 lines (11 loc) • 487 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.distanceManhattan2D = void 0;
/**
* Calculates the Manhattan distance between two 2D vectors.
* @param {ArrayVector2D} xy1 - First vector as `[x, y]`
* @param {ArrayVector2D} xy2 - Second vector as `[x, y]`
* @returns {number} Manhattan distance
*/
const distanceManhattan2D = (xy1, xy2) => Math.abs(xy2[0] - xy1[0]) + Math.abs(xy2[1] - xy1[1]);
exports.distanceManhattan2D = distanceManhattan2D;