squaredDistance function

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

Calculates the squared euclidian distance between two vec2's

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

Implementation

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