绘制 3D 图形时,如何定义其显示的角度?
我知道我可以在绘图完成后用鼠标将其旋转到所需的角度。现在,我想知道如何通过代码执行相同的操作。
I know I can after the plot is done, to rotate it with my mouse to the desired angle. Now, I'd like to know how to do the same through code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
3D 视图最方便地通过参数
ViewPoint
和ViewVertical
定义(还有其他选项:ViewCenter
、ViewVector
和ViewAngle
,但通常将它们保留为Automatic
就足够了)。因此,您可以执行以下操作:
要获得
ViewPoint
的良好值,等等。我将函数Get3DView
定义为 然后您只需将图形复制到
Get3DView
中获得您的选项:在此之后,您可以将您的
plotpar
作为新绘图命令的选项(注意评估):The 3D view is most conveniently defined through the parameters
ViewPoint
andViewVertical
(There are additional options:ViewCenter
,ViewVector
, andViewAngle
, but it usually suffices to leave them onAutomatic
).So you can do for example
To get good values for
ViewPoint
, etc. I define a functionGet3DView
asThen you just copy your graphics into
Get3DView
to get your options:After this you can put your
plotpar
as options for new plot commands (note the Evaluate):再看一遍,你的标题涉及 3d 旋转。为此,您可以使用 ViewPoint。应用程序选项卡下的示例似乎就是您正在寻找的内容。
您可以使用 ImageRotate 函数。
On second look your title involves 3d rotation. For that you can use ViewPoint. The example under the applications tab seems to be what you are looking for.
You can use the ImageRotate function.