concat method

GMatrix concat(
  1. GMatrix matrix
)

Concatenates the given matrix with this matrix by multiplying the two matrices together. This matrix is on the right-hand side and the given matrix is on the left-hand side. Returns the current matrix for chaining.

Implementation

GMatrix concat(GMatrix matrix) {
  double a1, c1, tx1;
  a1 = a * matrix.a + b * matrix.c;
  b = a * matrix.b + b * matrix.d;
  a = a1;

  c1 = c * matrix.a + d * matrix.c;
  d = c * matrix.b + d * matrix.d;
  c = c1;

  tx1 = tx * matrix.a + ty * matrix.c + matrix.tx;
  ty = tx * matrix.b + ty * matrix.d + matrix.ty;
  tx = tx1;
  return this;
}