append method

GMatrix append(
  1. GMatrix matrix
)

Multiplies this matrix by another matrix, concatenating the two matrices.

The resulting matrix combines the geometric effects of the two original matrices. In mathematical terms, if matrix A scales, rotates, and translates geometric object P, and matrix B scales, rotates, and translates geometric object Q, then the combined matrix C = A * B scales, rotates, and translates P and Q.

Returns this matrix after the concatenation for easy chaining

Implementation

GMatrix append(GMatrix matrix) {
  final a1 = a;
  final b1 = b;
  final c1 = c;
  final d1 = d;
  a = (matrix.a * a1) + (matrix.b * c1);
  b = (matrix.a * b1) + (matrix.b * d1);
  c = (matrix.c * a1) + (matrix.d * c1);
  d = (matrix.c * b1) + (matrix.d * d1);

  tx = (matrix.tx * a1) + (matrix.ty * c1) + tx;
  ty = (matrix.tx * b1) + (matrix.ty * d1) + ty;

  return this;
}