def get_orientate(self, tangent, up, scale): """ Transform stretches the length to the length of tangent and the radius to scale. """ return v3.combine(get_xy_face_transform(tangent, up, scale), v3.scaling_matrix(1.0, 1.0, v3.mag(tangent) / scale))
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))