ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 19 Sep 2016 10:53:16 -0500Add a 3d graphics object to a tachyon scenehttp://ask.sagemath.org/question/33320/add-a-3d-graphics-object-to-a-tachyon-scene/I'm trying to understand how to add 3d graphics objects to a tachyon scene.
Suppose I define a tachyon scene
sage: s = Tachyon(xres=512,yres=512, camera_center=(3,0.3,0))
and I define a torus and a 3d plot
sage: from sage.plot.plot3d.shapes import Torus
sage: t = Torus(0.5, 0.2)
sage: p = plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2))
How can I add `t` and `p` to `s`?
I know I can do `s.str()` and `t.tachyon()` and `p.tachyon()`
to get strings depicting `s`, `t` and `p` as tachyon scenes,
so I could fiddle with these strings, but is there a better way?
For instance, if I have a string depicting a tachyon scene,
can I turn it into a Sage tachyon scene, extract its objects,
add them to another scene's objects?
Thu, 05 May 2016 10:27:00 -0500http://ask.sagemath.org/question/33320/add-a-3d-graphics-object-to-a-tachyon-scene/Answer by niles for <p>I'm trying to understand how to add 3d graphics objects to a tachyon scene.</p>
<p>Suppose I define a tachyon scene</p>
<pre><code>sage: s = Tachyon(xres=512,yres=512, camera_center=(3,0.3,0))
</code></pre>
<p>and I define a torus and a 3d plot</p>
<pre><code>sage: from sage.plot.plot3d.shapes import Torus
sage: t = Torus(0.5, 0.2)
sage: p = plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2))
</code></pre>
<p>How can I add <code>t</code> and <code>p</code> to <code>s</code>?</p>
<p>I know I can do <code>s.str()</code> and <code>t.tachyon()</code> and <code>p.tachyon()</code>
to get strings depicting <code>s</code>, <code>t</code> and <code>p</code> as tachyon scenes,
so I could fiddle with these strings, but is there a better way?</p>
<p>For instance, if I have a string depicting a tachyon scene,
can I turn it into a Sage tachyon scene, extract its objects,
add them to another scene's objects?</p>
http://ask.sagemath.org/question/33320/add-a-3d-graphics-object-to-a-tachyon-scene/?answer=34859#post-id-34859This has been requested from time to time in the past. Functionality to do this automatically is definitely something we'd like to add to sage. There is an open ticket, and there you can see a few different approaches that people have given in the past. Hopefully one of them will help you with your task!
https://trac.sagemath.org/ticket/14428
Unfortunately, there isn't any active work on choosing a method and including it into sage. Any effort would be welcome :)
Mon, 19 Sep 2016 10:53:16 -0500http://ask.sagemath.org/question/33320/add-a-3d-graphics-object-to-a-tachyon-scene/?answer=34859#post-id-34859