how to rotated a cube 30 deg counterclockwise around the axis that passes through v1 and v8
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
A = [0 0 500];%v1 axis
B = [5 0 500];
C = [0 5 500];
D = [0 0 505];
E = [0 5 505];
F = [5 0 505];
G = [5 5 500];
H = [5 5 505];%v8 axis
P = [A;B;F;H;G;C;A;D;E;H;F;D;E;C;G;B];
plot3(P(:,1),P(:,2),P(:,3),'b'), hold on
V6--------------------------v8
/ /
/ /
/ /
V2----------------------------v3
|
|
|
| V7----------------------------V5
| / /
| / /
| / /
V1---------------------------- v4
0 commentaires
Réponses (1)
James Tursa
le 13 Sep 2016
Modifié(e) : James Tursa
le 13 Sep 2016
You can do the following steps:
1) Use v1 and v8 to form a unit rotation axis x
2) Use x and your desired rotation angle to form a rotation quaternion q
3) Convert q to a direction cosine matrix d
4) Multiply all of your points by d
For step 3 you would need a quaterion / dcm conversion routine. You could use quat2dcm from the Aerospace Toolbox, or you could use one of the converters from the FEX. E.g., this submission by John Fuller:
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!