compose method

Updates this transformation to be the composition of this transformation with the given {@link AffineTransformation}. This produces a transformation whose effect is equal to applying this transformation followed by the argument transformation. mathematically,

A.compose(B) = TB x TA

@param trans an affine transformation @return this transformation, with an updated matrix

Implementation

AffineTransformation compose(AffineTransformation trans) {
  double mp00 = trans.m00 * m00 + trans.m01 * m10;
  double mp01 = trans.m00 * m01 + trans.m01 * m11;
  double mp02 = trans.m00 * m02 + trans.m01 * m12 + trans.m02;
  double mp10 = trans.m10 * m00 + trans.m11 * m10;
  double mp11 = trans.m10 * m01 + trans.m11 * m11;
  double mp12 = trans.m10 * m02 + trans.m11 * m12 + trans.m12;
  m00 = mp00;
  m01 = mp01;
  m02 = mp02;
  m10 = mp10;
  m11 = mp11;
  m12 = mp12;
  return this;
}