How to rotate a surface(or a 2D plane) in 3D Cartesian coordinate ?

Hi everyone,
I am trying the tilt a 2 dimension plane or surface by some small incremental angle along a particular axis (1. about x - axis and 2. about y-axis) using the rotation matrix formula.
for example,
% the 3D volume has a dimension of - 64 x 64 x 64
% the plane is placed inside the 3D volume and is defined as a set of points
y = 24:1:40;
x(1, 1:size(y,2)) = 32;
z(1, 1:size(y,2)) = 20;
plane = [x; y; z];
So, when I try to rotate this plane about a particular axis using the rotation matrix, R = [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1], I am not able to find the new values of the x, y and z point for the considered plane correctly.
I also have confusion about the rotation (pitch, yaw and roll).
Therefore, if someone could please help me understand the concept about the rotation and suggest a correct way to appraoch the problem.
Thank you.

 Risposta accettata

See this example:
R = @(a) [cosd(a) -sind(a); sind(a) cosd(a)];
t = 0:.1:2*pi;
[x,y] = pol2cart(t,5+sin(5*t));
line(x,y)
v1 = R(15)*[x;y]; % rotate around Z axis
line(v1(1,:),v1(2,:),'color','r')
figure
z = x*0;
v2 = R(15)*[x;z]; % rotat around Y axis
plot(x,y)
line(v2(1,:),y,v2(2,:))
view(45,45)

4 Commenti

Hey Darova,
Thank you very much for your help.
Buddy I have two doubt,
(1) when you rotated the plane about the y- axis or about the z-axis. why didn't you consider the y and z values respectively. Since the value for all point contained on the plane will change (x,y,z) except for few (about which we rotate it).
(2) why did you write z = x*0 ?
(1) I didn't consider Z values when i rotated about Z axis because they won't change. The same thing with Y axis
(2) I created Z values. I assumed that a curve is plane (z=0)
Hey Darova ..
Thank you very much for answering my doubts ..
Let me try the approach you have suggested to solve my problem ..
Thanks once more
You are welcome. Let me know if it works

Accedi per commentare.

Più risposte (0)

Richiesto:

S
S
il 3 Set 2021

Commentato:

il 8 Set 2021

Community Treasure Hunt

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

Start Hunting!

Translated by