squaredDistance function

double squaredDistance(
  1. List<double> a,
  2. List<double> b
)

Calculates the squared euclidian distance between two vec4's

@param {ReadonlyVec4} a the first operand @param {ReadonlyVec4} b the second operand @returns {Number} squared distance between a and b

Implementation

double squaredDistance(List<double> a, List<double> b) {
  final x = b[0] - a[0];
  final y = b[1] - a[1];
  final z = b[2] - a[2];
  final w = b[3] - a[3];
  return x * x + y * y + z * z + w * w;
}