@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) • 586 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.divide3D = void 0;
/**
* Divides one 3D vector with another.
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
* @returns {ArrayVector3D} The divided vector
*/
const divide3D = (xyz1, xyz2) => [
xyz2[0] === 0 ? Number.POSITIVE_INFINITY : xyz1[0] / xyz2[0],
xyz2[1] === 0 ? Number.POSITIVE_INFINITY : xyz1[1] / xyz2[1],
xyz2[2] === 0 ? Number.POSITIVE_INFINITY : xyz1[2] / xyz2[2],
];
exports.divide3D = divide3D;