How to animate this object and rotate from initial to final?
조회 수: 8 (최근 30일)
이전 댓글 표시
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
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!