Ask Your Question

A way to rotate a tachyon plot

asked 2011-06-02 00:00:12 -0500

pang gravatar image

updated 2011-06-02 00:58:45 -0500

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 flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2011-06-02 00:38:31 -0500

niles gravatar image

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)
edit flag offensive delete link 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.

pang gravatar imagepang ( 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.

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

answered 2011-06-02 07:11:48 -0500

Kelvin Li gravatar image

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))

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.)

edit flag offensive delete link more


That didn't work for me because I had several implicit_plot_3d. I was able to use a trick from, but it was very verbose and a bit hacky. Thanks anyway, this might work for somebody else.

pang gravatar imagepang ( 2011-06-06 23:57:28 -0500 )edit

answered 2011-08-13 08:26:08 -0500

v_2e gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-06-02 00:00:12 -0500

Seen: 851 times

Last updated: Aug 13 '11