(self, other)
return AffineTransform((
            sm[0] * om[0] + sm[1] * om[3] + sm[2] * om[6],
            sm[0] * om[1] + sm[1] * om[4] + sm[2] * om[7],
            sm[0] * om[2] + sm[1] * om[5] + sm[2] * om[8],
            sm[3] * om[0] + sm[4] * om[3] + sm[5] * om[6],
            sm[3] * om[1] + sm[4] * om[4] + sm[5] * om[7],
            sm[3] * om[2] + sm[4] * om[5] + sm[5] * om[8],
            sm[6] * om[0] + sm[7] * om[3] + sm[8] * om[6],
            sm[6] * om[1] + sm[7] * om[4] + sm[8] * om[7],
            sm[6] * om[2] + sm[7] * om[5] + sm[8] * om[8],
        ))
Multiply this affine transformation by something.
        Accepts:
            * another AffineTransform:
                ``A * B``
            * a scalar:
                ``A * 3``
Multiply this affine transformation by something.
        Accepts:
            * another AffineTransform:
                ``A * B``
            * a scalar:
                ``A * 3``
Multiply this affine transformation by something . Accepts : * another AffineTransform : A * B * a scalar : A * 3
def __mul__(self, other):
        """
        Multiply this affine transformation by something.
        Accepts:
            * another AffineTransform:
                ``A * B``
            * a scalar:
                ``A * 3``
        """
        if not isinstance(other, AffineTransform):
            if isinstance(other, (tuple, list)):
                if len(other) not in (2, 3):
                    raise ValueError(
                        "AffineTransform can only be multiplied by vectors of length 2 or 3"
                    )
                sm = self.matrix
                if len(other) == 3:
                    return (
                        other[0] * sm[0] + other[1] * sm[3] + other[2] * sm[6],
                        other[0] * sm[1] + other[1] * sm[4] + other[2] * sm[7],
                        other[0] * sm[2] + other[1] * sm[5] + other[2] * sm[8],
                    )
                else:
                    return (
                        other[0] * sm[0] + other[1] * sm[3] + sm[6],
                        other[0] * sm[1] + other[1] * sm[4] + sm[7],
                    )
            # scalars: accept any arg we can convert to float
            try:
                s = float(other)
            except (ValueError, TypeError):
                # this will throw a TypeError (unsupported operand type)
                return NotImplemented
            # scalar multiplications are the same as scale matrix multiplications
            other = AffineTransform((
                s, 0, 0,
                0, s, 0,
                0, 0, s,
            ))

        sm = self.matrix
        om = other.matrix
        return AffineTransform((
            sm[0] * om[0] + sm[1] * om[3] + sm[2] * om[6],
            sm[0] * om[1] + sm[1] * om[4] + sm[2] * om[7],
            sm[0] * om[2] + sm[1] * om[5] + sm[2] * om[8],
            sm[3] * om[0] + sm[4] * om[3] + sm[5] * om[6],
            sm[3] * om[1] + sm[4] * om[4] + sm[5] * om[7],
            sm[3] * om[2] + sm[4] * om[5] + sm[5] * om[8],
            sm[6] * om[0] + sm[7] * om[3] + sm[8] * om[6],
            sm[6] * om[1] + sm[7] * om[4] + sm[8] * om[7],
            sm[6] * om[2] + sm[7] * om[5] + sm[8] * om[8],
        ))
def __mul__ ( self , other ) : if not isinstance ( other , AffineTransform ) : if isinstance ( other , ( tuple , list ) ) : if len ( other ) not in ( 2 , 3 ) : raise ValueError ( "AffineTransform can only be multiplied by vectors of length 2 or 3" ) sm = self . matrix if len ( other ) == 3 : return ( other [ 0 ] * sm [ 0 ] + other [ 1 ] * sm [ 3 ] + other [ 2 ] * sm [ 6 ] , other [ 0 ] * sm [ 1 ] + other [ 1 ] * sm [ 4 ] + other [ 2 ] * sm [ 7 ] , other [ 0 ] * sm [ 2 ] + other [ 1 ] * sm [ 5 ] + other [ 2 ] * sm [ 8 ] , ) else : return ( other [ 0 ] * sm [ 0 ] + other [ 1 ] * sm [ 3 ] + sm [ 6 ] , other [ 0 ] * sm [ 1 ] + other [ 1 ] * sm [ 4 ] + sm [ 7 ] , ) # scalars: accept any arg we can convert to float try : s = float ( other ) except ( ValueError , TypeError ) : # this will throw a TypeError (unsupported operand type) return NotImplemented # scalar multiplications are the same as scale matrix multiplications other = AffineTransform ( ( s , 0 , 0 , 0 , s , 0 , 0 , 0 , s , ) ) sm = self . matrix om = other . matrix return AffineTransform ( ( sm [ 0 ] * om [ 0 ] + sm [ 1 ] * om [ 3 ] + sm [ 2 ] * om [ 6 ] , sm [ 0 ] * om [ 1 ] + sm [ 1 ] * om [ 4 ] + sm [ 2 ] * om [ 7 ] , sm [ 0 ] * om [ 2 ] + sm [ 1 ] * om [ 5 ] + sm [ 2 ] * om [ 8 ] , sm [ 3 ] * om [ 0 ] + sm [ 4 ] * om [ 3 ] + sm [ 5 ] * om [ 6 ] , sm [ 3 ] * om [ 1 ] + sm [ 4 ] * om [ 4 ] + sm [ 5 ] * om [ 7 ] , sm [ 3 ] * om [ 2 ] + sm [ 4 ] * om [ 5 ] + sm [ 5 ] * om [ 8 ] , sm [ 6 ] * om [ 0 ] + sm [ 7 ] * om [ 3 ] + sm [ 8 ] * om [ 6 ] , sm [ 6 ] * om [ 1 ] + sm [ 7 ] * om [ 4 ] + sm [ 8 ] * om [ 7 ] , sm [ 6 ] * om [ 2 ] + sm [ 7 ] * om [ 5 ] + sm [ 8 ] * om [ 8 ] , ) )