UNPKG

@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.

16 lines (15 loc) 564 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.distanceChebyshev2D = void 0; /** * Calculates the Chebyshev distance between two 2D vectors. * @param {ArrayVector2D} xy1 - First vector as `[x, y]` * @param {ArrayVector2D} xy2 - Second vector as `[x, y]` * @returns {number} Chebyshev distance */ const distanceChebyshev2D = (xy1, xy2) => { const absX = Math.abs(xy1[0] - xy2[0]); const absY = Math.abs(xy1[1] - xy2[1]); return absX >= absY ? absX : absY; }; exports.distanceChebyshev2D = distanceChebyshev2D;