I'm trying to draw a figure as shown below and make it rotate around the vertical axis (z-axis) automatically.
This is how I generate the figure and make it rotate:
Δϕ = π 14.0/13.0;
p1 =
Show[
Table[
RegionPlot3D[
x^2 + y^2 + (z - j)^2 < 0.5^2 &&
(x - 0.4 Cos[j Δϕ]) Cos[j Δϕ] + (y - 0.4 Sin[j Δϕ]) Sin[j Δϕ] < 0,
{x, -0.5, 0.5}, {y, -0.5, 0.5}, {z, -0.5 + j, 0.5 + j},
PlotStyle -> Blue, Mesh -> None],
{j, 0, 5}],
PlotRange -> All, BoxRatios -> Automatic];
p2 =
Graphics3D[
Table[
Arrow[{{0.4 Cos[j Δϕ], 0.4 Sin[j Δϕ], j}, {Cos[j Δϕ], Sin[j Δϕ], j}}],
{j, 0, 5}]];
p =
Show[{p1, p2},
Boxed -> False, Axes -> False,
ViewPoint -> {0, -10, 0}, ViewCenter -> {0, 0, 2.5},
ViewVertical -> {0, 0, 1}];
vc = AbsoluteOptions[p, ViewCenter][[1, 2]];
vp = AbsoluteOptions[p, ViewPoint][[1, 2]];
m = RotationMatrix [5 Degree, {0., 0., 1.}];
newvp = m.(vp - vc);
Export["a.gif",
Table[
Show[p,
ViewPoint -> MatrixPower[m, j].(vp - vc) + vc,
PlotRange -> All],
{j, 0, 360/5 - 1}]];
This is how the gif file looks like
I don't understand why the gif is kind of oscillating in the horizontal direction, and the arrows seem turn around when a cycle is done and the next cycle starts. What I want is to have the rotating axis (here the z-axis) fixed while the figure is rotating. Which part of my code is wrong?
PlotRange
instead ofPlotRange -> All
, and maybe add aSphericalRegion -> True
while you're at it. $\endgroup$PlotRange
, but it didn't work. AddingSphericalRegion -> True
only shows a tiny part of the figure. $\endgroup$Arrowheads[Medium, Appearance -> "Projected"]
in your 3D expression. $\endgroup$