Next / Previous / Contents / Shipman's homepage

8.2. Xform.apply(): Transform a point

Transforming a point is one operation: a matrix multiplication. This operation is provided by the num.dot() (dot product) function.

homcoord.py
# - - -   X f o r m . a p p l y

    def apply ( self, p ):
        '''Transform a point.
        '''
        #-- 1 --
        # [ pp  :=  a num.array representing the dot product of
        #           self.__m and p.v ]
        pp = num.dot(self.__m, p.v)

        #-- 2 --
        # [ return a Pt instance representing pp.v ]
        return Pt(pp)