Question
Write a program (Python) that plots a rotated 3D image of a cube where the user can specify the rotation about the x, y and
Write a program (Python) that plots a rotated 3D image of a cube where the user can specify the rotation about the x, y and z axis. Given a set of n, (x,y,z) coordinates, stored in a matrix as follows:
# ask user for x,y,z rotations in degrees. You will need to convert to radians for calculation
# call the rotateXYZ function with the XYZ matrix and the three rotations angles
# this function calculates the Rx, Ry and Rz matrices and calls the myMultMatrix
# three time to calculate the rotated # XYZcalculate the three rotation matrices.
# extract the x and y vectors from the rotated matrix # plot the data
Write a program that plots a rotated 3D image of a aube where the user can specify the rotation about the x, y and z axis. Given a set ofn, ,y, coordinates, stored in a matrix as follows and rotational transformation matrices of the fonm cosBy 0 sine, 0 sin6 cos siny 0 cosy Then, the rotated (x,yz) sct of coordinatos is XYZntated Use the following x,y,z coordinates to define cube xyz- np.array([[,1,1,8,0, 0,,1,1,8, 1.1.1,1, a, To plot the 3D cube in 2D plot only the x and y points, connect with a line. You can extract the x and y vectors using numpy's submatrik formula as follows x . xyzrl,:) . w 9 and every column y-xyzr(,:] # row 1 and every column Your code should have the following outline def mynultMatrix(A,B): # check for conpatible natrices and return if Incompatible your code to calculate C return C A x B def rotatexzz,rx,ry,rz): # calculate the rotation nat rices and use my ultatrix to # perform the calculations return ask user for x,y,z rotations in degrees. You wil need to convert to radians for kution tcall the rotateYZ function with the XY2 matrixand the three rotations angles this function caloulates the Rx, Ry and Rz matrices and calls the myMultMatrix threc tme to calculate the rotated XYZcalkulate the three rotation matrices Write a program that plots a rotated 3D image of a aube where the user can specify the rotation about the x, y and z axis. Given a set ofn, ,y, coordinates, stored in a matrix as follows and rotational transformation matrices of the fonm cosBy 0 sine, 0 sin6 cos siny 0 cosy Then, the rotated (x,yz) sct of coordinatos is XYZntated Use the following x,y,z coordinates to define cube xyz- np.array([[,1,1,8,0, 0,,1,1,8, 1.1.1,1, a, To plot the 3D cube in 2D plot only the x and y points, connect with a line. You can extract the x and y vectors using numpy's submatrik formula as follows x . xyzrl,:) . w 9 and every column y-xyzr(,:] # row 1 and every column Your code should have the following outline def mynultMatrix(A,B): # check for conpatible natrices and return if Incompatible your code to calculate C return C A x B def rotatexzz,rx,ry,rz): # calculate the rotation nat rices and use my ultatrix to # perform the calculations return ask user for x,y,z rotations in degrees. You wil need to convert to radians for kution tcall the rotateYZ function with the XY2 matrixand the three rotations angles this function caloulates the Rx, Ry and Rz matrices and calls the myMultMatrix threc tme to calculate the rotated XYZcalkulate the three rotation matricesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started