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.

12 lines (11 loc) 510 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.distanceSq3D = void 0; /** * Calculates the squared Euclidean distance between two 3D vectors. * @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]` * @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]` * @returns {number} Squared Euclidian distance */ const distanceSq3D = (xyz1, xyz2) => (xyz1[0] - xyz2[0]) ** 2 + (xyz1[1] - xyz2[1]) ** 2 + (xyz1[2] - xyz2[2]) ** 2; exports.distanceSq3D = distanceSq3D;