Effacer les filtres
Effacer les filtres

How to animate this object and rotate from initial to final?

8 vues (au cours des 30 derniers jours)
GURPREET
GURPREET le 1 Août 2012
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

Réponses (1)

Sumit Tandon
Sumit Tandon le 1 Août 2012
You can use a combination of the functions CAMORBIT, GETFRAME and MOVIE to rotate and object, capture a snapshot of the figure as a movie frame and then play it back as a movie.

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by