def get_xy_face_transform(tangent, up, scale): m = v3.identity() left = v3.cross(up, tangent) m[:3, 0] = scale * v3.norm(left) m[:3, 1] = scale * v3.norm(up) m[:3, 2] = scale * v3.norm(tangent) return m
def test_matrix_combination(): n = 4 x = v3.random_vector() y1 = v3.vector(x) matrix = v3.identity() for i in range(4): r_matrix = v3.random_matrix() y1 = v3.transform(r_matrix, y1) matrix = v3.combine(r_matrix, matrix) y2 = v3.transform(matrix, x) assert v3.is_similar_vector(y1, y2)
def test_inverse(): m = v3.random_matrix() m_left_inv = v3.left_inverse(m) assert v3.is_similar_matrix(v3.identity(), v3.combine(m_left_inv, m))