(self, t11=None, t12=None, t21=None, t22=None)
Set or return the current transformation matrix of the turtle shape.

        Optional arguments: t11, t12, t21, t22 -- numbers.

        If none of the matrix elements are given, return the transformation
        matrix.
        Otherwise set the given elements and transform the turtleshape
        according to the matrix consisting of first row t11, t12 and
        second row t21, 22.
        Modify stretchfactor, shearfactor and tiltangle according to the
        given matrix.

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("square")
        >>> turtle.shapesize(4,2)
        >>> turtle.shearfactor(-0.5)
        >>> turtle.shapetransform()
        (4.0, -1.0, -0.0, 2.0)
Set or return the current transformation matrix of the turtle shape.
Set or return the current transformation matrix of the turtle shape .
def shapetransform(self, t11=None, t12=None, t21=None, t22=None):
        """Set or return the current transformation matrix of the turtle shape.

        Optional arguments: t11, t12, t21, t22 -- numbers.

        If none of the matrix elements are given, return the transformation
        matrix.
        Otherwise set the given elements and transform the turtleshape
        according to the matrix consisting of first row t11, t12 and
        second row t21, 22.
        Modify stretchfactor, shearfactor and tiltangle according to the
        given matrix.

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("square")
        >>> turtle.shapesize(4,2)
        >>> turtle.shearfactor(-0.5)
        >>> turtle.shapetransform()
        (4.0, -1.0, -0.0, 2.0)
        """
        if t11 is t12 is t21 is t22 is None:
            return self._shapetrafo
        m11, m12, m21, m22 = self._shapetrafo
        if t11 is not None: m11 = t11
        if t12 is not None: m12 = t12
        if t21 is not None: m21 = t21
        if t22 is not None: m22 = t22
        if t11 * t22 - t12 * t21 == 0:
            raise TurtleGraphicsError("Bad shape transform matrix: must not be singular")
        self._shapetrafo = (m11, m12, m21, m22)
        alfa = math.atan2(-m21, m11) % math.tau
        sa, ca = math.sin(alfa), math.cos(alfa)
        a11, a12, a21, a22 = (ca*m11 - sa*m21, ca*m12 - sa*m22,
                              sa*m11 + ca*m21, sa*m12 + ca*m22)
        self._stretchfactor = a11, a22
        self._shearfactor = a12/a22
        self._tilt = alfa
        self.pen(resizemode="user")
def shapetransform ( self , t11 = None , t12 = None , t21 = None , t22 = None ) : if t11 is t12 is t21 is t22 is None : return self . _shapetrafo m11 , m12 , m21 , m22 = self . _shapetrafo if t11 is not None : m11 = t11 if t12 is not None : m12 = t12 if t21 is not None : m21 = t21 if t22 is not None : m22 = t22 if t11 * t22 - t12 * t21 == 0 : raise TurtleGraphicsError ( "Bad shape transform matrix: must not be singular" ) self . _shapetrafo = ( m11 , m12 , m21 , m22 ) alfa = math . atan2 ( - m21 , m11 ) % math . tau sa , ca = math . sin ( alfa ) , math . cos ( alfa ) a11 , a12 , a21 , a22 = ( ca * m11 - sa * m21 , ca * m12 - sa * m22 , sa * m11 + ca * m21 , sa * m12 + ca * m22 ) self . _stretchfactor = a11 , a22 self . _shearfactor = a12 / a22 self . _tilt = alfa self . pen ( resizemode = "user" )