필터 지우기
필터 지우기

Translating a hemisphere in 3D

조회 수: 11 (최근 30일)
Jonathan Bird
Jonathan Bird 2018년 4월 12일
댓글: Star Strider 2018년 4월 12일
I have created a hemisphere with the following code and then rotated it by 90 degrees. I now want to translate the shape to a new position vector. Thanks
[x1,y1,z1]=sphere;
x1=x1(11:end,:);
y1=y1(11:end,:);
z1=z1(11:end,:);
r=10;
sf=surf(r.*x1,r.*y1,r.*z1);
rotate(sf,[1,0,0],90);
axis equal;

채택된 답변

Star Strider
Star Strider 2018년 4월 12일
Try this:
[x1,y1,z1]=sphere;
x1=x1(11:end,:);
y1=y1(11:end,:);
z1=z1(11:end,:);
r=10;
figure
sf=surf(r.*x1,r.*y1,r.*z1);
rotate(sf,[1,0,0],90);
hold on
XD = get(sf, 'XData');
YD = get(sf, 'YData');
ZD = get(sf, 'ZData');
surf(XD-10, YD+15, ZD+20)
hold off
axis equal
  댓글 수: 6
Jonathan Bird
Jonathan Bird 2018년 4월 12일
Awesome thank you
Star Strider
Star Strider 2018년 4월 12일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by