vector projection on rotated coordinate system

8 次查看(过去 30 天)
I have to vectors: red (XR, YR, ZR) and blue (XB, YB, ZB) in XYZ coordinate
system. I would like to calculate projection of these two vectors on X'Y', X'Z' and Y'Z' planes
where X'Y'Z' is rotaded, along Z (angle 'alpha') and Y (angle 'beta') axises, coordinate system XYZ.
Vectors stay in old XYZ system (are not rotated). Only system is rotaded along two axisies.
Any suggestions how this could be done?
rotation.jpg

采纳的回答

Matt J
Matt J 2019-12-27
编辑:Matt J 2019-12-27
I'll assume your given vectors are in a 3x2 matrix called columnVectors, that your angles are in degrees, and that rotations are done in Z first and Y second.
Rz=@(x) [cosd(x),-sind(x),0 ; ...
sind(x),cosd(x),0 ;...
0 0 1];
Ry = @(x) [cosd(x), 0, sind(x); 0 1 0; -sind(x), 0, cosd(x) ];
R=Ry(beta)*Rz(alpha); %ANGLES ARE IN DEGREES!!
[XpYp,XpZp,YpZp]=deal(R.'*columnVectors);
XpYp(3,:)=0; %X'Y'
XpZp(2,:)=0; %X'Z'
YpZp(1,:)=0; %Y'Z'
XpYp=R*XpYp;
XpZp=R*XpZp;
YpZp=R*YpZp;

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by