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) 733 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isEqualApprox3D = void 0; /** * Compares two 3D vectors using an epsilon value for floating-point comparison. * @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]` * @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]` * @param {number} epsilon - Tolerance for comparison (default: `Number.EPSILON`) * @returns {boolean} `true` if the vectors are approximately equal, `false` otherwise */ const isEqualApprox3D = (xyz1, xyz2, epsilon = Number.EPSILON) => Math.abs(xyz1[0] - xyz2[0]) <= epsilon && Math.abs(xyz1[1] - xyz2[1]) <= epsilon && Math.abs(xyz1[2] - xyz2[2]) <= epsilon; exports.isEqualApprox3D = isEqualApprox3D;