How to animate a 3d-graph taking into account the axis of rotation in mathematics

If a normalized rotation axis is specified, such as {1 / Sqrt [3], 1 / Sqrt [3], 1 / Sqrt [3]} and a 3d graph, 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 animation for this graph around the axis {1 / Sqrt [3], 1 / Sqrt [3], 1 / Sqrt [3]} (it can be any other harsh), and then export it as an animated gif. Can someone please help? Thank you very much.

Edit

I also ruled out one degree of freedom when indicating a turn. Can someone help if you also give the coordinate of the point that the rotation axis should go through, how to make visualization / animation? Thanks again.

+4
source share
2 answers

You can do as shown 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 Lichtblow Wolfram Research

+6
source

Copying what Daniel did, just ready for export.

 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 options are available for exporting gifs (according to 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 have used "DisplayDurations" in the past and it worked.

+7
source

Source: https://habr.com/ru/post/1341717/


All Articles