A way to rotate a tachyon plot

I can rotate a plot3d using the Java viewer, and then take an image. I'd like to use tachyon, but then how do I choose the right angle to take the picture?

I'd like to rotate the whole plot, or in other words, "place the camera in an arbitrary position"?

edit retag close merge delete

Sort by » oldest newest most voted

Does the .rotate() method do what you want? Compare the output of:

sage: var('x,y')
(x, y)
sage: P = plot3d(sin(x*y), (x,-2,2), (y,-2,2))
sage: Q = P.rotate((0,0,1),pi/4)
sage: P.show(viewer='tachyon')
sage: Q.show(viewer='tachyon')

more

I can't believe I didn't see that one! I'll edit the question so that it's less confusing... but it wasn't a waste: I'll use the Tachyon stuff anyway.

( 2011-06-02 00:57:25 -0500 )edit

While this isn't my thread, I'd like to thank the poster: this totally answers a question I was wondering about.

( 2011-08-13 14:57:01 -0500 )edit

Another option is the sage.plot.plot3d.tachyon.Tachyon interface (which is imported into the global namespace by default). Basically, you create a Tachyon scene instance, setup the contents of the scene, then render. Here is a slightly modified example from the Tachyon docstring:

sage: t = Tachyon(xres=512,yres=512, camera_center=(3,0.3,0), look_at=(0,0,0), updir=(0,0,1))
sage: t.light((4,3,2), 0.2, (1,1,1))
sage: t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(1.0,0,0))
sage: t.texture('t1', ambient=0.1, diffuse=0.9, specular=0.3, opacity=1.0, color=(0,1.0,0))
sage: t.texture('t2', ambient=0.2,diffuse=0.7, specular=0.5, opacity=0.7, color=(0,0,1.0))
sage: k=0
sage: for i in srange(-1,1,0.05):
...    k += 1
...    t.sphere((i,i^2-0.5,i^3), 0.1, 't%s'%(k%3))
...
sage: t.show()


The key here is the first line--the arguments camera_center, look_at, and updir, which are quite self-explanatory.

The only problem with this mechanism is that you must directly use Tachyon's methods to construct objects instead of Sage's usual plotting interfaces. (Graphics3d, plot3d, parametric_plot3d, etc.)

more

That didn't work for me because I had several implicit_plot_3d. I was able to use a trick from http://ask.sagemath.org/question/20/the-tachyon-object-used-for-rendering-plots, but it was very verbose and a bit hacky. Thanks anyway, this might work for somebody else.

( 2011-06-06 23:57:28 -0500 )edit

Unfortunately the rotate() method didn't work for my implicit_plot3d plot. It seems a bit strange. Why not making the additional options such as camera_center available via the show() method? There are some "extra_opts" parameter in show() method, but it is not clear how to use it and whether it is actually possible to pass the camera_center parameter through it.

more