multiply method

Transform2D multiply(
  1. Transform2D other
)

Returns a composition of this transform with other (this * other).

When applied to a point, other is applied first and this transform second: (this * other).apply(p) == this.apply(other.apply(p)).

Implementation

Transform2D multiply(Transform2D other) {
  return Transform2D(
    a: a * other.a + c * other.b,
    b: b * other.a + d * other.b,
    c: a * other.c + c * other.d,
    d: b * other.c + d * other.d,
    tx: a * other.tx + c * other.ty + tx,
    ty: b * other.tx + d * other.ty + ty,
  );
}