rhb-server/mes-ui/rhb-app/node_modules/gl-vec3/squaredDistance.js
2025-10-20 11:14:41 +08:00

15 lines
374 B
JavaScript

module.exports = squaredDistance;
/**
* Calculates the squared euclidian distance between two vec3's
*
* @param {vec3} a the first operand
* @param {vec3} b the second operand
* @returns {Number} squared distance between a and b
*/
function squaredDistance(a, b) {
var x = b[0] - a[0],
y = b[1] - a[1],
z = b[2] - a[2]
return x*x + y*y + z*z
}