boolequals function

dynamic boolequals(
  1. dynamic a,
  2. dynamic b
)

Returns whether or not the vectors have approximately the same elements in the same position.

@param {ReadonlyVec2} a The first vector. @param {ReadonlyVec2} b The second vector. @returns {Boolean} True if the vectors are equal, false otherwise.

Implementation

boolequals(a, b) {
  final a0 = a[0], a1 = a[1];
  final b0 = b[0], b1 = b[1];
  return ((a0 - b0).abs() <= GlMatrix.EPSILON * math.max(1.0, math.max(a0.abs(), b0.abs())) &&
      (a1 - b1).abs() <= GlMatrix.EPSILON * math.max(1.0, math.max(a1.abs(), b1.abs())));
}