1 | initial version |

William Stein's answer was very helpful for me, but I also wanted to animate output of a plot3d based function (specifically I was trying to animate a surface of revolution, therefore I was using the revolution_plot3d function, but it's the same idea). Essentially, if you look at how the tachyon string is created, you can recreate the functionality quite simply. Here's a function that allows you to combine a plot3d output with a Tachyon object.

```
from sage.plot.plot3d.base import flatten_list
from sage.plot.plot3d.transform import Transformation
def combineTachyonPlot(T,P):
P = P.transform(scale=[-1,1,1]) # Tachyon does not have a right-hand-rule coordinate system
render_params = P.default_render_params()
return r"""
begin_scene
%s
%s
%s
%s
%s
end_scene"""%(
T._res(),
T._camera(),
'\n'.join([x.str() for x in T._objects]),
'\n'.join(sorted([t.tachyon_str() for t in P.texture_set()])),
'\n'.join(flatten_list(P.tachyon_repr(render_params))))
# Example how to use this
T = Tachyon(xres=1024,yres=576, camera_center=(0,20,20), updir=(0,0,1) , viewdir=(0,-20,-20), antialiasing=True)
T.light((4,3,5), 0.2, (1,1,1))
T.texture('bg', ambient=1, diffuse=1, specular=1, opacity=1, color=(1,1,1))
T.plane((-2000,-1000,-500),(2.3,2.4,2.0),'bg')
u,v = var('u,v')
P = plot3d(u^2+v^2,(-2,2),(-2,2))
tachyon_rt(combineTachyonPlot(T,P))
```

You can add things to the Tachyon object as you see fit, lights, backgrounds, spheres, etc. You can also add a 2-dimensional plot to the variable P and Tachyon will render it as well.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.