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.

15 lines (14 loc) 503 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.divide2D = void 0; /** * Divides one 2D vector with another. * @param {ArrayVector2D} xy1 - First vector as `[x, y]` * @param {ArrayVector2D} xy2 - Second vector as `[x, y]` * @returns {ArrayVector2D} The divided value */ const divide2D = (xy1, xy2) => [ xy2[0] === 0 ? Number.POSITIVE_INFINITY : xy1[0] / xy2[0], xy2[1] === 0 ? Number.POSITIVE_INFINITY : xy1[1] / xy2[1], ]; exports.divide2D = divide2D;