How to animate this object and rotate from initial to final?
8 views (last 30 days)
Show older comments
Hi I have this object that looks like a flower and i want to rotate from its initial position to its final position. I have the code. the objects from initial to 30 degrees to 45 degrees and stops at 60 degrees. I want to make it like a movie
The Code
original
x = -2.5:.1:2.5;
y = -2.5:.1:2.5;
[X,Y] = meshgrid(x,y);
Z = 2*sin(X.*Y);
surf(X,Y,Z)
Final
title('flower')
yr = (sqrt (3)+1)/2
xr = (3 * sqrt (2) - sqrt(6))/4
zr = (sqrt(6) + sqrt(2))/4
xs = (6+2*sqrt(3)+3*sqrt(2)+sqrt(6))/8
ys = (2+ 2*sqrt(3) +3*sqrt(2)-3*sqrt(6))/8
zs = (sqrt(6) + sqrt(2))/4
X = -2.5:.1:2.5;
y = -2.5:.1:2.5;
[X,Y] = meshgrid(x,y);
Z = 2*sin(X.*Y);
H1 = surf(X,Y,Z)
zdir = [1 1.3660 .3660];
rotate(H1,zdir,30)
zdir = [yr xr zr];
rotate(H1,zdir,45)
zdir = [ys xs zs];
rotate(H1,zdir,60)
grid on
hold on
0 Comments
Answers (1)
See Also
Categories
Find more on Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!