def Transforms(S): T = [] h, l1, l2 = S.L theta1, theta2, theta3, d = S.Theta Ti = v.translation_matrix(0, 0, h) T.append(Ti) T1 = v.translation_matrix(l1, 0, 0) T2 = v.rotation_matrix(theta1, 0, 0, 1) Ti = Mul(T2, T1) T.append(Ti) T1 = v.translation_matrix(l2, 0, 0) T2 = v.rotation_matrix(theta2, 0, 0, 1) Ti = Mul(T2, T1) T.append(Ti) T1 = v.translation_matrix(0, 0, -d) T2 = v.rotation_matrix(theta3, 0, 0, 1) Ti = Mul(T2, T1) T.append(Ti) T.reverse() return T
def Transforms(S): T = [] n = len(S.Theta) for i in range(n - 1, -1, -1): T1 = v.translation_matrix(S.L[i], 0, 0) T2 = v.rotation_matrix(S.Theta[i], 0, 0, 1) # z-axis Ti = Mul(T2, T1) T.append(Ti) T.reverse() return T
def Transforms(S): T = [] Ti = v.translation_matrix(S.A[0], S.A[0], S.A[1]) Ri = v.rotation_matrix(S.Theta[0] + 90, 0, 1, 0) T.append(Mul(Ti, Ri)) Ti = v.translation_matrix(S.A[2], S.A[2], S.A[3]) Ri = v.rotation_matrix(S.Theta[1], 0, 0, 1) T.append(Mul(Ti, Ri)) Ti = v.translation_matrix(S.A[4], S.A[4], S.A[5]) Ri = v.rotation_matrix(S.Theta[2] - 90, 0, 1, 0) T.append(Mul(Ti, Ri)) Ri = v.rotation_matrix(S.Theta[3] + 90, 0, 1, 0) T.append(Ri) Ri = v.rotation_matrix(S.Theta[4] - 90, 0, 1, 0) T.append(Ri) Ri = v.rotation_matrix(S.Theta[5], 0, 0, 1) T.append(Ri) T.reverse() return T
def Transforms(S): T = [] l1,l2,l3 = S.L theta1,theta2,theta3 = S.Theta T1 = v.translation_matrix(l1,0,0) T2 = v.rotation_matrix(theta1,0,0,1) Ti = Mul(T2,T1) T.append(Ti) T1 = v.translation_matrix(l2,0,0) T2 = v.rotation_matrix(theta2,0,0,1) Ti = Mul(T2,T1) T.append(Ti) T1 = v.translation_matrix(l3,0,0) T2 = v.rotation_matrix(theta3,0,0,1) Ti = Mul(T2,T1) T.append(Ti) #T.reverse() return T
def Rotate(shape, theta, align=True): R = vec.rotation_matrix(theta, 0, 0, 1) SHAPE = Transform(shape, R) if align: SHAPE = Round(SHAPE) return SHAPE
def Rotate(shape, degrees, x, y, z): R = v.rotation_matrix(degrees, x, y, z) SHAPE = Transform(shape, R) return SHAPE