equals function

bool equals(
  1. dynamic a,
  2. dynamic b
)

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

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

Implementation

bool equals(a, b) {
  final a0 = a[0], a1 = a[1], a2 = a[2];
  final b0 = b[0], b1 = b[1], b2 = b[2];
  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())) &&
      (a2 - b2).abs() <= GlMatrix.EPSILON * math.max(1.0, math.max(a2.abs(), b2.abs())));
}