Next / Previous / Contents / Shipman's homepage

8.11. Xform.mag(): Net magnification of the transform

To find out how much this transform magnifies a unit length, we transform point (1, 0) and then find the distance from the origin of the transformed point.

homcoord.py
# - - -   X f o r m . m a g

    def mag(self):
        '''Return the net (uniform) scaling of this transform.
        '''
        #-- 1 --
        # [ if self.__offset is None ->
        #     self.__offset  :=  net translation of self
        #     self.__angle  :=  net rotation of self
        #     self.__mag  :=  net uniform scaling of self
        #   else -> I ]
        self.__analyze()

        #-- 2 --
        return self.__mag