Next / Previous / Contents / Shipman's homepage

9. Xlate(): Create a translation

This convenience function creates a translation transform. For the function that decodes the positional argument(s), see Section 15, “argPair(): Process one or two arguments”.

homcoord.py
# - - -   X l a t e

def Xlate(*p):
    '''Create a translation transform.
    '''
    #-- 1 --
    # [ dx  :=  first value from p
    #   dy  :=  second value from p ]
    dx, dy = argPair ( *p )

    #-- 2 --
    return Xform ( [ (1, 0, dx),
                     (0, 1, dy),
                     (0, 0, 1)  ] )