Get current rotation of a surf plot

조회 수: 53 (최근 30일)
Dale Huffman
Dale Huffman 2017년 2월 10일
댓글: Dale Huffman 2017년 2월 13일
Is there a method to get/save the current rotation of a surf plot. We want to rotate a plot (3D), by hand using "rotate3d on", to our desired viewpoint, and then save that rotation to be applied exactly the same to all future plots. I can't seem to find any ".getRotation" type functions or attributes.
  댓글 수: 1
Dale Huffman
Dale Huffman 2017년 2월 13일
Thank you all, (Star Strider, Jan Simon, and Jonh BG). All very good and relevant information. I accepted SS's answer because that is the answer that worked for us for now. I spent some time with the campos and RotateStyles, all good info. If I could "accept" all 3, I would. (Let me know if I can - newbie here to these forums) Thank you again.

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

채택된 답변

Star Strider
Star Strider 2017년 2월 10일
편집: Star Strider 2017년 2월 10일
The view (link) function will do that:
  • [az,el] = view returns the current azimuth and elevation.
EDIT They’re also displayed dynamically in the lower left corner of the figure GUI.
  댓글 수: 1
Jan
Jan 2017년 2월 12일
편집: Jan 2017년 2월 12일
+1. Or explicitly:
[X,Y,Z] = peaks(25);
figure
hAxes = axes;
surf(X,Y,Z, 'Parent', hAxes);
...
get(hAxes, 'View')
This is the way e.g. rotate3d updates the status text in the lower left corner.

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

추가 답변 (2개)

John BG
John BG 2017년 2월 11일
campos returns the camera position
for instance, these axes
campos
=
0.500000000000000 0.500000000000000 9.160254037844386
have the point of view on the z axis, at 9.1 above away from x y plane
Have you tried the MATLAB intro example for campos and rotate around a vibrating membrane
surf(peaks)
axis vis3d off
for x = -200:5:200
campos([x,5,100])
drawnow
end
to get right on target
campos([0 0 100])
.
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG

Jan
Jan 2017년 2월 12일
The answer is not trivial: rotate3d can rotate an object using the view angle or the camera orbit, see the parameter 'RotateStyle'. The DataAspectRatio of the axes object can be skewed, such that the replied angle does not match the visible impression on the screen.
In my experiments, Star Strider's suggestion worked.
  댓글 수: 2
Star Strider
Star Strider 2017년 2월 12일
Thank you, Jan!
Jan
Jan 2017년 2월 12일
@Star Stride: You are welcome.

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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by