@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.
17 lines (16 loc) • 677 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.divide4D = void 0;
/**
* Divides two 4D vectors component-wise.
* @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
* @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
* @returns {ArrayVector4D} The divided vector
*/
const divide4D = (xyzw1, xyzw2) => [
xyzw2[0] === 0 ? Number.POSITIVE_INFINITY : xyzw1[0] / xyzw2[0],
xyzw2[1] === 0 ? Number.POSITIVE_INFINITY : xyzw1[1] / xyzw2[1],
xyzw2[2] === 0 ? Number.POSITIVE_INFINITY : xyzw1[2] / xyzw2[2],
xyzw2[3] === 0 ? Number.POSITIVE_INFINITY : xyzw1[3] / xyzw2[3],
];
exports.divide4D = divide4D;