Large amount of coordinates transformation in 3D
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am trying to perform transformation of large amount of coordinates, but firstly I am doing it on this small example:
I would like to rotate by 10 degrees about y axis x y z coordinates ( size is 8 x 3). How to perform such rotation? I have found rotation matrices but they are 3x3 and if I want to mupliply matrices [3x3] * [8x3] it is not possible.
Therefore I would like to ask you for help.
theta = 10;
A = [0 0 0; 1 1 1; 0 0 1; 1 1 0; 1 0 1; 0 1 0; 0 1 1; 1 0 0];
x = A(:,1); y = A(:,2); z = A(:,3);
RY = [
cosd(theta) 0 sind(theta)
0 1 0;
-sind(theta) 0 cosd(theta)];
ARY = RY*A;
Best regards
Michal
댓글 수: 0
채택된 답변
Chunru
2022년 7월 13일
Transpose A:
theta = 10;
A = [0 0 0; 1 1 1; 0 0 1; 1 1 0; 1 0 1; 0 1 0; 0 1 1; 1 0 0]';
x = A(:,1); y = A(:,2); z = A(:,3);
RY = [
cosd(theta) 0 sind(theta)
0 1 0;
-sind(theta) 0 cosd(theta)];
ARY = RY*A
A
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2022년 7월 13일
theta = 10;
M = makehgtform('yrotate', deg2rad(theta))
A = [0 0 0; 1 1 1; 0 0 1; 1 1 0; 1 0 1; 0 1 0; 0 1 1; 1 0 0];
x = A(:,1); y = A(:,2); z = A(:,3);
c = zeros(size(x));
xyzc = [x, y, z, c];
newxyz = xyzc * M
newx = newxyz(:,1); newy = newxyz(:,2); newz = newxyz(:,3);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!