ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 05 May 2016 10:27:00 -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?
slelievreThu, 05 May 2016 10:27:00 -0500http://ask.sagemath.org/question/33320/Implicit plot in tachyon scenehttp://ask.sagemath.org/question/26639/implicit-plot-in-tachyon-scene/Is there a way to get some implicit plot, or some other graphic object in general into a tachyon scene?
Something like:
t = Tachyon(xres=400,yres=400, camera_center=(4,30,30), look_at=(0,0,0))
t.ImplicitPlot3d( ... )
Or can I modify the camera_center parameter when using the tachyon viewer in the show() method?
ThorstenFri, 24 Apr 2015 12:37:52 -0500http://ask.sagemath.org/question/26639/Rendering a torus in Tachyonhttp://ask.sagemath.org/question/26442/rendering-a-torus-in-tachyon/I'm trying to figure out how to render a torus using Tachyon. The problem is that a solid torus requires a 2 variable parametric equation, and it seems Tachyon only likes to use single variable parametric equations. Is there a way around this? Jeff FordSun, 05 Apr 2015 18:57:06 -0500http://ask.sagemath.org/question/26442/Tachyon in SageMathCloudhttp://ask.sagemath.org/question/24746/tachyon-in-sagemathcloud/I'm new to Sage and only beginner experience in python, so there may be something obvious I'm missing.
I'm trying to create, initially, some plots using Tachyon in SMC. I cut and pasted Niles Johnson's code [at this question](http://ask.sagemath.org/question/7586/the-tachyon-object-used-for-rendering-plots/), namely
sage: f = lambda t: (t,t^2,t^3)
sage: t = Tachyon(camera_center=(5,0,4))
sage: t.texture('t')
sage: t.light((-20,-20,40), 0.2, (1,1,1))
sage: t.parametric_plot(f,-5,5,'t',min_depth=6)
sage: t.show(verbose=True)
and I get the following error
tachyon /projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_Iy4Cih.dat -format PNG -o /projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_weeBQD.png ; rm -f "/projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_Iy4Cih.dat"
Error in lines 6-6
Traceback (most recent call last):
File "/projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sagemathcloud/sage_server.py", line 864, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/usr/local/sage/sage-6.3.beta6/local/lib/python2.7/site-packages/sage/plot/plot3d/tachyon.py", line 339, in show
os.system('%s %s 2>/dev/null 1>/dev/null &'%(sage.misc.viewer.png_viewer(), filename))
NameError: global name 'sage' is not defined
What should I do? It doesn't seem related to anything in the code used.David RobertsSun, 02 Nov 2014 22:27:35 -0600http://ask.sagemath.org/question/24746/The boundary of an implicit_plot3d are jittery.http://ask.sagemath.org/question/24370/the-boundary-of-an-implicit_plot3d-are-jittery/ I am making a contour plot in a restricted region using the following commands:
var('x,y,z')
implicit_plot3d((x^2+y^2-.4)*(x^2+z^2-.4)*(z^2+y^2-.4)*(x^2+(y-z)^2/2-.4)*(z^2+(x-y)^2/2-.4)*(y^2+(x-z)^2/2-.4)*(x^2+(y+z)^2/2-.4)*(z^2+(x+y)^2/2-.4)*(y^2+(x+z)^2/2-.4)==1, (x, -3, 3), (y, -3,3), (z, -3,3), color='green', plot_points=100, region=lambda x,y,z: x^2+y^2+z^2<10)
The surface is restricted to a ball, using the region command. This is because I need to illustrate a surface with its boundary meeting the corresponding sphere.
My problem is that some of the boundary cylinders have their border very jittery. They look like a saw. I need them to be smooth, as some others actually are.
I tried using Adaptative=true, without any success. The same problem also applies when I use tachyon to render rather than jmol.
Any suggestions would be welcome.
Thank you
alexgWed, 01 Oct 2014 18:53:42 -0500http://ask.sagemath.org/question/24370/The tachyon object used for rendering plotshttp://ask.sagemath.org/question/7586/the-tachyon-object-used-for-rendering-plots/When I render a 3d plot using viewer='tachyon', is there any way to "get to" the Tachyon object that is being used, in order to change (or even just examine) it's attributes?
Alternatively, does Tachyon.plot actually work? If so, can I see a sample of working code? I've been able to get Tachyon.parametric_plot to work, but not Tachyon.plot. When I try the examples given in t.plot? they don't work for me -- t.show('verbose='true') says something like:
Parse Error:
Encountered a syntax error in file ...
Last question: Is the above question the sort of thing that I should be asking in this forum?Mike WittThu, 19 Aug 2010 05:41:16 -0500http://ask.sagemath.org/question/7586/Save 3d plot to an imagehttp://ask.sagemath.org/question/10363/save-3d-plot-to-an-image/With a Jmol-produced 3d plot, saving to an image results in different output to that which is displayed on the screen.
I have
G.show(aspect_ratio=1)
and that looks lovely, but
G.save('tmp.png',aspect_ratio=1)
produces something quite different, I suspect because G.show() uses Jmol, and G.save() uses Tachyon. The "export" menu item of Jmol doesn't seem to produce very good results either, as the image is not properly centered on the page, and sometimes is even clipped. Any ideas how I can go from my Jmol image to a nice image file? (Other than taking a screenshot!)AlasdairThu, 18 Jul 2013 17:30:53 -0500http://ask.sagemath.org/question/10363/different color on backside of surfacehttp://ask.sagemath.org/question/10290/different-color-on-backside-of-surface/Hey,
I want to animate a 3D plot. Therefore I generate tachyon rendered implicit plots which I then send to ffmpeg. This works quite well. The only disadvantege, is that it's during the video hard to distinguish which side of the surface one sees. Therefore I want to change the color of the backside or at least increase the shadow.
I already tried some stuff with the tachyon raytracer building a scene. But this does not work for implicit plots. The solution given [here](http://ask.sagemath.org/question/20/the-tachyon-object-used-for-rendering-plots) seems not to be very usefull in this context.
Is there perhaps a simply trick, which does the job?
ThorstenWed, 26 Jun 2013 10:38:03 -0500http://ask.sagemath.org/question/10290/Add text to Tachyon image?http://ask.sagemath.org/question/9322/add-text-to-tachyon-image/Hi folks, is there a way to add text to Tachyon images? I tried
S = sphere(opacity=0.8, aspect_ratio=[1,1,1])
T = text3d('hello world', (2,2,2))
M = S + T
M.show(viewer='tachyon', frame=False)
in the Sage notebook, but that didn't work. Got a sphere but no text. I also searched the docs, but couldn't find anything relevant.araichevSun, 16 Sep 2012 14:00:10 -0500http://ask.sagemath.org/question/9322/3d animation with tachyonhttp://ask.sagemath.org/question/8947/3d-animation-with-tachyon/Hello!
I'm trying to create a 3d animations, frame per frame. I've discovered that tachyon plotter is very usefull to create images. But after that, I'm unable to make it as animation.
For example, I have copied a code and generate some scenes with tachyon with this:
saved = []
for j in srange(-0.9,1,0.3):
t = Tachyon(xres=512,yres=512, camera_center=(3,0.3,0))
t.light((4,3,2), 0.2, (1,1,1))
t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.5, opacity=1.0, color=(1.0,0,0))
t.texture('t1', ambient=0.1, diffuse=0.9, specular=0.3, opacity=1.0, color=(0,1.0,0))
t.texture('t2', ambient=0.2,diffuse=0.7, specular=0.5, opacity=0.7, color=(0,0,1.0))
k=0
for i in srange(-1,j,0.05):
k += 1
t.sphere((i,i^2-0.5,i^3), 0.1, 't%s'%(k%3))
saved.append(t)
In "saved" array I have all the png of the animation I want to do, and I can view it with saved[i].show().
I tried to unite all the frames with the command animate:
animate(saved[i].show() for i in range(0,len(saved)))
But it didn't work. What other alternatives do I have? (without using ffmpeg)
Thank you!RoctivThu, 17 May 2012 03:35:17 -0500http://ask.sagemath.org/question/8947/A way to rotate a tachyon plothttp://ask.sagemath.org/question/8143/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"?pangThu, 02 Jun 2011 00:00:12 -0500http://ask.sagemath.org/question/8143/animate 3d plots?http://ask.sagemath.org/question/7666/animate-3d-plots/Is there an animation function for 3d plots? Specifically, I'm looking to animate some plots drawn with Tachyon, but I don't see any animation functions either in the [Tachyon documentation](http://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html) or in the [3d base classes documentation](http://www.sagemath.org/doc/reference/sage/plot/plot3d/base.html). I have seen that there is an animate function for [2d plots](http://www.sagemath.org/doc/reference/sage/plot/animate.html), but it says that the input needs to be a "graphics object", and I don't think Tachyon objects are recognized as such. So maybe modifying the 2d animation functions could do what I want, but is there something else already available?
For an example, an animation where the curve changes color from magenta to white would be great:
<pre>
sage: f = lambda t: (t,t^2,t^3)
sage: t = Tachyon(camera_center=(5,0,4))
sage: t.texture('t')
sage: t.light((-20,-20,40), 0.2, (1,1,1))
sage: t.parametric_plot(f,-5,5,'t',min_depth=6)
sage: t.show()
</pre>
p.s. If this **is** already available, I'll volunteer to add information about it to the Tachyon documentation.nilesSat, 04 Sep 2010 03:59:25 -0500http://ask.sagemath.org/question/7666/