Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def scale_matrix(*scale):
    scale_vec = matrix.row_vector(list(scale))
    scale_mat = matrix.eye(len(scale))
    
    mat = matrix.Matrix(
        [
            [
                (scale[col] if col == row else 0) for
                col in range(len(scale))
            ] for
        row in range(len(scale))
        ]
    )
    
    return mat
        


src/i/n/Ink2Impress-HEAD/Ink2Impress.py   Ink2Impress(Download)
 
import matutil
from matutil import E_X, E_Y, Matrix, scale_matrix, rotation_matrix, eye, translation_matrix
 
TRANSFORM_MATRIX_PAT = r"matrix\(([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)\)"
def scale_transform(sx, sy):
    return Transform(scale_matrix(sx, sy, 1))
 
def rotation_transform(r):
    return Transform(rotation_matrix(3, 0, 1, r))