3D ellipsoid turns 2D after rotation
1 次查看(过去 30 天)
显示 更早的评论
Hello!
I am currently working on a program that requires the rotation of an ellipsoid in 3D space. Previous questions like this lead me to the "rotate" function where I could input an angle for the three axes. The issue is when I rotate about either the y or z axes, my ellipsoid turns 2D. When I rotate about both the y and z axes, the surface turns into a line. This rotation works fine around the x-axis.
Code Below:
% Get fz ellipsoid points
[ex,ey,ez] = ellipsoid(xc,yc,zc,foci2end,fzradius,fzradius);
figure(1)
hold all;
% Fresnel Zone
fresnelzone = surf(ex,ey,ez); % Surface Plot
set(fresnelzone,'EdgeColor','none'); % Edge Color/Transparency Settings
set(fresnelzone,'FaceAlpha','.4');
% Rotate Ellipsoid
rotate(fresnelzone,[1 0 0], angle_x);
rotate(fresnelzone,[0 1 0], angle_y);
rotate(fresnelzone,[0 0 1], angle_z);
% Plot Label/View Settings
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
view(3);
Thanks for any help!!
0 个评论
采纳的回答
Shadaab Siddiqie
2020-8-28
I have implemented the function and found even a rotation across y or z axis, I am still getting an 3D ellipsoid. Note that you can view the ellipsoid from different angles with the help of the cursor (mouser). Also make sure that neither of the semi-axis lengths are zero. For more information please visit https://in.mathworks.com/help/matlab/ref/surf.html
1 个评论
Kenton Young
2020-8-28
Thanks for the help! I found out my y-axis calculation resulted in a zero with the data I was using.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Map Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!