3d object rotation

11 ビュー (過去 30 日間)
Jae-Hee Park
Jae-Hee Park 2022 年 6 月 16 日
コメント済み: Jae-Hee Park 2022 年 6 月 17 日
Hi!
I Just make 2 sphere which one of them is orientated on origin and the other positioned on far from origin.
then I want to rotate just origin sphere in z axis so it may looks like not changed I think.
but it rotating like double star.
please help me.
erad = 6000;
prad = 6000;
npanels = 180;
hold on;
axis equal;
axis vis3d;
[x, y, z] = ellipsoid(0,0,0,erad,erad,prad,npanels);
globe1 = surf(gca,x,y,-z,'FaceColor','none','EdgeColor',0.5*[1 1 1]);
globe2 = surf(gca,x+30000,y,-z,'FaceColor','none','EdgeColor',0.5*[1 1 1]);
view(3);
for i=0:100
rotate(globe1,[0 1 1],20); % I want just rotate globe1
pause(0.2);
end

採用された回答

Kevin Holly
Kevin Holly 2022 年 6 月 16 日
Keep you axes limits consistent. That should help when viewing.
figure
erad = 6000;
prad = 6000;
npanels = 180;
hold on;
axis equal;
axis vis3d;
[x, y, z] = ellipsoid(0,0,0,erad,erad,prad,npanels);
globe1 = surf(gca,x,y,-z,'FaceColor','none','EdgeColor',0.5*[1 1 1]);
globe2 = surf(gca,x+30000,y,-z,'FaceColor','none','EdgeColor',0.5*[1 1 1]);
view(3);
xlim([0 40000])
ylim([-20000 20000])
zlim([-10000 10000])
for i=0:100
rotate(globe1,[0 1 1],20); % I want just rotate globe1
pause(0.2);
end
  2 件のコメント
Jae-Hee Park
Jae-Hee Park 2022 年 6 月 17 日
@Kevin Holly I want Globe 1 to rotate on its own and Globe 2 to stand still. The code above looks like globe1 orbits globe2.
Jae-Hee Park
Jae-Hee Park 2022 年 6 月 17 日
I solve this problem just change like this
rotate(globe1,[0 1 1],20); --> rotate(globe1,[0 1 1],20,[0 0 0]);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeodesy and Mapping についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by