A way to rotate a tachyon plot

i like this post (click again to cancel)
2
i dont like this post (click again to cancel)

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"?

asked Jun 02 '11

pang gravatar image pang
167 3 10
http://www.uam.es/persona...

updated Jun 02 '11

3 Answers:

i like this answer (click again to cancel)
5
i dont like this answer (click again to cancel) pang has selected this answer as correct

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

posted Jun 02 '11

niles gravatar image niles
3354 5 38 92
http://nilesjohnson.net/
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 (Jun 02 '11)
While this isn't my thread, I'd like to thank the poster: this totally answers a question I was wondering about. StevenPollack (Aug 13 '11)
i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel)

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

link

posted Jun 02 '11

Kelvin Li gravatar image Kelvin Li
423 9 16
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. pang (Jun 07 '11)
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

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.

link

posted Aug 13 '11

v_2e gravatar image v_2e flag of Ukraine
219 1 10 24

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Jun 02 '11

Seen: 270 times

Last updated: Aug 13 '11

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.