Next / Previous / Contents / Shipman's homepage

8.4. Xform.invert(): Invert the transform

This method reverses the transform. For example, if self represents the transform from scene space to display space, the inverse transform will convert a coordinate from display space back to scene space.

The math is straightforward: multiplying the inverse of the transform by the point's vector gives us the new point's vector. Matrix inversion is implemented by the .inv() function in the linear algebra sub-module num.linalg.
# - - -   X f o r m . i n v e r t

    def invert ( self, p ):
        '''Return p transformed by the inverse of self, as a Pt.
        return self.inverse().apply ( p )