equals function

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

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

@param {ReadonlyMat2} a The first matrix. @param {ReadonlyMat2} b The second matrix. @returns {Boolean} True if the matrices are equal, false otherwise.

Implementation

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