1
$\begingroup$

I want that that cylinder plotted by

RevolutionPlot3D[{Sin[t], Cos[t], u}, {t, 0, 2 Pi}, {u, -10, 0.02}]

to rotate around its vertical axis. If possible I want to use Animate[Rotate[]] command, because I'm not very expert. I will give that cylinder a texture, this way I will be able to see its rotation around the z axis.

$\endgroup$
3
  • $\begingroup$ Which axis in your mind is the "vertical" axis? In my mind, for the cylinder your code produces, it the z-axis of the coordinate system. But rotating about that axis will produce no visual change in the plot, because the cylinder is rotationally symmetrical about that axis. Please clarify your intent. $\endgroup$
    – m_goldberg
    May 8, 2015 at 17:46
  • $\begingroup$ The axis I want to indicate Is the axis you're intending, I will give the cylinder a texture to make that rotation visible... $\endgroup$
    – Marco
    May 8, 2015 at 17:50
  • $\begingroup$ You should not omit such important information in your question. $\endgroup$
    – m_goldberg
    May 8, 2015 at 17:56

3 Answers 3

2
$\begingroup$

RevolutionPlot3D will distort the texture badly. Things will look much better if you use ParametricPlot3D. Here is an example.

Animate[ParametricPlot3D[{Sin[t], Cos[t], u}, {t, 0, 2 Pi}, {u, -10, 0.02},
  PlotStyle -> Texture[ExampleData[{"TestImage", "Lena"}]],
    SphericalRegion -> True,
    Mesh -> None,
    Boxed -> False,
    Axes -> None,
    BoxRatios -> {1, 1, 2},
    Lighting -> "Neutral",
    ViewPoint -> {100 Cos[θ], 100 Sin[θ], -5}],
  {θ, 4. π/3, 10. π/3, 2. π/12},
  Deployed -> True,
  DefaultDuration -> 30]

lena

Note that the animation actually rotates the camera's position (the view point) around a fixed cylinder rather than rotating the cylinder while keeping the camera fixed. It is really easier to do this by rotating the camera.

$\endgroup$
1
  • $\begingroup$ Very cool bro :D $\endgroup$
    – Marco
    May 8, 2015 at 20:42
0
$\begingroup$

If you want to view the cylinder from different directions:

 Animate[
    ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]], h}, 
         {\[Theta], 0, 2 \[Pi]}, {h, 0, 5},
    PlotPoints -> 50,
    ViewPoint -> {2 Cos[\[Phi]], 2 Sin[\[Phi]], 3}],
 {\[Phi], 0, 2 \[Pi], .1}]
$\endgroup$
1
  • $\begingroup$ It's possible to do a similiar thing with "ParametricPlot3D" command? It's easier to give a texture to the object in a "Plot" command... $\endgroup$
    – Marco
    May 8, 2015 at 18:30
0
$\begingroup$

You can also RotateRight the Texture image to get the same visual effect:

im = ExampleData[{"TestImage", "Lena"}];
dim = ImageDimensions[im][[1]];
imdt = ImageData@im;

Animate[ParametricPlot3D[{Sin[t], Cos[t], u}, {t, 0, 2 Pi}, {u, -10, 0.02}, 
  PlotStyle -> FaceForm[Yellow, Texture[Image[RotateRight[#, r] & /@ imdt]]], 
  SphericalRegion -> True, Mesh -> None, Boxed -> False, Axes -> None,
   BoxRatios -> {1, 1, 2}, Lighting -> "Neutral", PerformanceGoal -> "Quality"], 
{r, 0, dim, 1}]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.