如何在数学中为给定旋转轴的 3D 绘图制作动画

发布于 2024-10-19 09:32:38 字数 457 浏览 1 评论 0原文

如果给定标准化旋转轴,例如 {1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]} 和 3d 图,例如

z[x_, y_] : = Exp[-(Sqrt[x^2 + y^2]/Power[4, (3)^-1]) + Power[4, (3)^-1]*Sqrt[1/2*(Sqrt[x^2 + y^2] + x)]];

Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}]

我想为此图创建一个关于轴 {1/Sqrt[3],1/Sqrt[3] 的动画],1/Sqrt[3]}(可以是任何其他任意的),然后将其导出为动画 gif。有人愿意帮忙吗?非常感谢。

编辑

我还在指定旋转时遗漏了一个自由度。任何人都可以帮忙,如果还给出了旋转轴必须经过的点的坐标,如何进行可视化/动画? 再次感谢。

If given a rotation axis normalized, such as {1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]}, and a 3d plot, for example,

z[x_, y_] := Exp[-(Sqrt[x^2 + y^2]/Power[4, (3)^-1]) +
Power[4, (3)^-1]*Sqrt[1/2*(Sqrt[x^2 + y^2] + x)]];

Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}]

I want to create an animation for this plot about the axis {1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]} (could be any other arbitary one), and then export it as an animated gif. Would anyone please help? Many thanks.

Edit

I also left out one degree of freedom in specifying the rotation. Could any one please help, if also given the coordinate of a point which the rotational axis must pass, how to do the visualization/animation?
Thanks again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你在我安 2024-10-26 09:32:38

复制大牛的做法,刚刚准备导出。

axis = {1, 1, 1};
l = {-7, 7};

s = Table[

      Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}, PlotRange -> {l, l, l}] /. 

      gg : GraphicsComplex[___] :> Rotate[gg, theta, axis], {theta, 0., 2. Pi}];

Export["c:\\test.gif", s]

在此处输入图像描述

以下参数可用于 gif 导出(根据文档):

"AnimationRepetitions" how many times the animation is played before stopping
"Background"           background color shown in transparent image regions 
"BitDepth"             bits used to represent each color channel in the file
"ColorMap"             color reduction palette, given as a list of color values
"GlobalColorMap"       default color palette for individual animation frames
"DisplayDurations"     display durations of animation frames, given in seconds
"ImageCount"           number of frames in an animated GIF
"ImageSize"            overall image size
"RawData"              array of color map indices
"Comments"             user comments stored in the file

我在中使用了“DisplayDurations”过去,它起作用了。

Copying what Daniel did, just prepared for exporting.

axis = {1, 1, 1};
l = {-7, 7};

s = Table[

      Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}, PlotRange -> {l, l, l}] /. 

      gg : GraphicsComplex[___] :> Rotate[gg, theta, axis], {theta, 0., 2. Pi}];

Export["c:\\test.gif", s]

enter image description here

The following parameters are available for the gif export (as per the docs):

"AnimationRepetitions" how many times the animation is played before stopping
"Background"           background color shown in transparent image regions 
"BitDepth"             bits used to represent each color channel in the file
"ColorMap"             color reduction palette, given as a list of color values
"GlobalColorMap"       default color palette for individual animation frames
"DisplayDurations"     display durations of animation frames, given in seconds
"ImageCount"           number of frames in an animated GIF
"ImageSize"            overall image size
"RawData"              array of color map indices
"Comments"             user comments stored in the file

I used "DisplayDurations" in the past, and it worked.

清浅ˋ旧时光 2024-10-26 09:32:38

可以做如下。

axis = {1, 1, 1};

Animate[
  Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}] /. 
    gg : GraphicsComplex[___] :> Rotate[gg, theta, axis],
  {theta, 0., 2.*Pi}]

在此处输入图像描述

Daniel Lichtblau
沃尔夫勒姆研究公司

Could do as below.

axis = {1, 1, 1};

Animate[
  Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}] /. 
    gg : GraphicsComplex[___] :> Rotate[gg, theta, axis],
  {theta, 0., 2.*Pi}]

enter image description here

Daniel Lichtblau
Wolfram Research

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文