composeBefore method

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

A.composeBefore(B) = TA x TB

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

Implementation

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