def step_impl(context): print(context.T) print(context.U) assert context.U == matrix(4, 4, [[0.21805, 0.45113, 0.24060, -0.04511], [-0.80827, -1.45677, -0.44361, 0.52068], [-0.07895, -0.22368, -0.05263, 0.19737], [-0.52256, -0.81391, -0.30075, 0.30639]])
def step_impl(context): tmpMatrix = matrix(4, 4) tmpMatrix.data = [[20, 22, 50, 48], [44, 54, 114, 108], [40, 58, 110, 102], [16, 26, 46, 42]] print(context.D * context.E) assert context.D * context.E == tmpMatrix
def step_impl(context): context.M = matrix(4, 4) context.M.srow(0, [1, 2, 3, 4]) context.M.srow(1, [5.5, 6.5, 7.5, 8.5]) context.M.srow(2, [9, 10, 11, 12]) context.M.srow(3, [13.5, 14.5, 15.5, 16.5]) context.M[1, 0] = 5.5 print(context.M)
def step_impl(context): assert inverse(context.V) == matrix( 4, 4, [[-0.15385, -0.15385, -0.28205, -0.53846], [-0.07692, 0.12308, 0.02564, 0.03077], [0.35897, 0.35897, 0.43590, 0.92308], [-0.69231, -0.69231, -0.76923, -1.92308]])
def step_impl(context): context.H = matrix(4, 4) context.H.data = [[0, 9, 3, 0], [9, 8, 0, 8], [1, 8, 5, 3], [0, 0, 5, 8]] context.Ht = matrix(4, 4) context.Ht.data = [[0, 9, 1, 0], [9, 8, 8, 0], [3, 0, 5, 5], [0, 8, 3, 8]]
def translation(x,y,z): return matrix(4,4, [ [1,0,0,x], [0,1,0,y], [0,0,1,z], [0,0,0,1]])
def rotation_z(r): return matrix(4,4, [ [cos(r), -sin(r), 0,0],[sin(r),cos(r), 0,0],[0,0,1,0],[0,0,0,1]])
def rotation_x(r): return matrix(4,4, [ [1,0,0,0], [0, cos(r), -sin(r), 0], [0,sin(r),cos(r),0], [0,0,0,1]])
def step_impl(context): context.C = matrix(4, 4) context.C.srow(0, [1, 2, 3, 0]) context.C.srow(1, [5.5, 6.5, 7.5, 8.5]) context.C.srow(2, [9, 10, 11, 12]) context.C.srow(3, [13.5, 14.5, 15.5, 16.5])
def step_impl(context): context.Y = matrix( 4, 4, [[3, -9, 7, 3], [3, -8, 2, -9], [-4, 4, 4, 1], [-6, 5, -1, 1]])
def step_impl(context): context.Q = matrix(3, 3, [[1, 2, 6], [-5, 8, -4], [2, 6, 4]])
def step_impl(context): context.P = matrix(3, 3, [[3, 5, 0], [2, -1, -7], [6, -1, 5]])
def step_impl(context): assert submatrix(context.L, 2, 1) == matrix(3, 3, [[-6, 1, 6], [-8, 8, 6], [-7, -1, 1]])
def step_impl(context): context.L = matrix( 4, 4, [[-6, 1, 1, 6], [-8, 5, 8, 6], [-1, 0, 8, 2], [-7, 1, -1, 1]])
def step_impl(context): assert submatrix(context.K, 0, 2) == matrix(2, 2, [[-3, 2], [0, 6]])
def step_impl(context): context.K = matrix(3, 3) context.K.data = [[1, 5, 0], [-3, 2, 7], [0, 6, -3]]
def step_impl(context): context.J = matrix(2, 2) context.J.data = [[1, 5], [-3, 2]]
def step_impl(context): context.X = matrix( 4, 4, [[9, 3, 0, 9], [-5, -2, -6, -3], [-4, 9, 6, 4], [-7, 6, 6, 2]])
def step_impl(context): assert inverse(context.X) == matrix( 4, 4, [[-0.04074, -0.07778, 0.14444, -0.22222], [-0.07778, 0.03333, 0.36667, -0.33333], [-0.02901, -0.14630, -0.10926, 0.12963], [0.17778, 0.06667, -0.26667, 0.33333]])
def step_impl(context): context.Q = matrix( 4, 4, [[-2, -8, 3, 5], [-3, 1, 7, 3], [1, 2, -9, 6], [-6, 7, 7, -9]])
def step_impl(context): context.Z = matrix( 4, 4, [[8, 2, 2, 2], [3, -1, 7, 0], [7, 0, 5, 4], [6, -2, 0, 5]])
def step_impl(context): context.R = matrix( 4, 4, [[6, 4, 4, 4], [5, 5, 7, 6], [4, -9, 3, -7], [9, 1, 7, -6]])
def step_impl(context): context.D = matrix(4, 4) context.D.data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 8, 7, 6], [5, 4, 3, 2]]
def step_impl(context): context.S = matrix( 4, 4, [[-4, 2, -2, -3], [9, 6, 2, 6], [0, -5, 1, -5], [0, 0, 0, 0]])
def rotation_y(r): return matrix(4,4, [ [cos(r), 0,sin(r),0],[0,1,0,0],[-sin(r), 0, cos(r),0],[0,0,0,1]])
def step_impl(context): context.T = matrix( 4, 4, [[-5, 2, 6, -8], [1, -5, 1, 8], [7, 7, -6, -7], [1, -3, 7, 4]])
def shearing(xy,xz, yx, yz, zx,zy): return matrix(4,4, [ [1,xy,xz,0],[yx,1,yz,0],[zx,zy,1,0],[0,0,0,1]])
def step_impl(context): context.V = matrix( 4, 4, [[8, -5, 9, 2], [7, 5, 6, 1], [-6, -0, 9, 6], [-3, 0, -9, -4]])
def scaling(x,y,z): return matrix(4,4, [ [x,0,0,0], [0,y,0,0], [0,0,z,0], [0,0,0,1]])
def step_impl(context): context.G = matrix(4, 4) context.G.data = [[0, 1, 2, 4], [1, 2, 4, 8], [2, 4, 8, 16], [4, 8, 16, 32]]