Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Animation of a rotating object. (Mathematica 6)

169 views
Skip to first unread message

Nacho

unread,
Aug 31, 2007, 12:00:40 AM8/31/07
to
Hello.

I'm trying to make an animation of a rotating 3D object and I'm having
some problems.

I want to make a list of images to export them to an AVI file.

For example, the following object:

a = Plot3D[Sin[x y], {x, -5, 5}, {y, -5, 5}, MaxRecursion -> 1,
PlotPoints -> 50, Mesh -> None];

I want to rotate it around the z axis slowly. I've tried Rotate and
changing ViewPoint, but neither work for me because Rotate distorted
the scale of every image and changing ViewPoint only works if I want
to rotate everything at the same time.

I think that I should use Rotate, so I can Rotate several objects in
different angles or speeds. But I would like to avoid the distortion
in the size of the image:

I've tried specifying PlotRange, and it looks promising, but I have
two problems: calculating the best PlotRange paramters so everything
is included, and maximizing the plotted area (so the white region
around the objects is minimized).

This is close, but a lot of white space is around the object, and I
have to set the limits of PlotRange by try-and-see.

b = Table[
Graphics3D[Rotate[a[[1]], phi, {0, 0, 1}], Boxed -> False,
PlotRange -> {{-7, 7}, {-7, 7}, {-1, 1}}], {phi, 0, 1/4 Pi,
1/4 Pi /5}]


Any hint to do this?

The object doesn't need to be this particular Plot3D. It could be a
ParametricPlot3D, several Graphics3D primitives, etc.

Thanks a lot.

Best regards.


Wim W. Wilhelm

unread,
Sep 1, 2007, 12:23:19 AM9/1/07
to
In version 6. you might do the
following:
Manipulate[{Plot3D[Sin[x y], {x, -5, 5},
{y, -5, 5}, MaxRecursion -> 1,
PlotPoints -> 50, Mesh -> None, Boxed ->
False,
ViewPoint -> {x, y, 2}]}, {x, -2, 2},
{y, -2, 2}]

Regards.

Wim W. Wilhelm


"Nacho" <ncc17...@gmail.com> wrote in
message
news:fb83p8$849$1...@smc.twtelecom.net...

David Park

unread,
Sep 1, 2007, 12:32:28 AM9/1/07
to
With animation you almost always have to specify PlotRange (as you did) to
prevent 'frame jitter'.

To zoom in on the object use PlotRegion (in a somewhat unconventional
manner).

a = Plot3D[Sin[x y], {x, -5, 5}, {y, -5, 5}, MaxRecursion -> 1,
PlotPoints -> 50, Mesh -> None]


Manipulate[Graphics3D[Rotate[a[[1]], phi, {0, 0, 1}],


Boxed -> False,
PlotRange -> {{-7, 7}, {-7, 7}, {-1, 1}},

PlotRegion -> {{-0.2, 1.2}, {-0.2, 1.1}}],
{phi, 0, Pi/2}]

You can use Table instead of Manipulate to export your graphics.

--
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/


"Nacho" <ncc17...@gmail.com> wrote in message
news:fb83p8$849$1...@smc.twtelecom.net...

Roger Bagula

unread,
Sep 1, 2007, 12:38:32 AM9/1/07
to
This transform works in version 5:
Clear[x1, y1, x, y]
x1[t_] = x Cos[t] - y Sin[t]
y1[t_] = y Cos[t] + x Sin[t]
Table[Plot3D[Sin[x1[t]* y1[t]], {x, -5, 5}, {y, -5, 5},
PlotPoints -> 50, Mesh -> False], {t, -Pi, Pi, Pi/10}]

Hello.

Thanks a lot.

Best regards.

a = Plot3D[Sin[x y], {x, -5, 5}, {y, -5, 5}, MaxRecursion -&gt; 1,
PlotPoints -&gt; 50, Mesh -&gt; None];

I want to rotate it around the z axis slowly. I've tried Rotate and
changing ViewPoint, but neither work for me because Rotate distorted
the scale of every image and changing ViewPoint only works if I want
to rotate everything at the same time.

I think that I should use Rotate, so I can Rotate several objects in
different angles or speeds. But I would like to avoid the distortion
in the size of the image:

I've tried specifying PlotRange, and it looks promising, but I have
two problems: calculating the best PlotRange paramters so everything
is included, and maximizing the plotted area (so the white region
around the objects is minimized).

This is close, but a lot of white space is around the object, and I
have to set the limits of PlotRange by try-and-see.

b = Table[
Graphics3D[Rotate[a[[1]], phi, {0, 0, 1}], Boxed -&gt; False,
PlotRange -&gt; {{-7, 7}, {-7, 7}, {-1, 1}}], {phi, 0, 1/4 Pi,
1/4 Pi /5}]


Any hint to do this?

The object doesn't need to be this particular Plot3D. It could be a
ParametricPlot3D, several Graphics3D primitives, etc.

Thanks a lot.

Best regards.


</pre>
</body>
</html>

--------------090205020104050601020100--

Nacho

unread,
Sep 3, 2007, 6:11:56 AM9/3/07
to
Hello David.

On Sep 1, 6:32 am, "David Park" <djmp...@comcast.net> wrote:
> With animation you almost always have to specify PlotRange (as you did) to
> prevent 'frame jitter'.
>
> To zoom in on the object use PlotRegion (in a somewhat unconventional
> manner).


This is just what I was looking for! It would be nice to have a more
easy way, but I suppose it will do the trick.

Best regards.


Kevin

unread,
Nov 1, 2007, 6:30:41 AM11/1/07
to
On Sep 3, 6:11 am, Nacho <ncc1701...@gmail.com> wrote:
> Hello David.

You could also try "SphericalRegion->True" as an option for Graphics3D


0 new messages