1 | initial version |
Hi Mike,
Last things first:
Last question: Is the above question the sort of thing that I should be asking in this forum?
As I understand it, this kind of question is precisely what this site was created for.
Now for the Tachyon questions: I don't know how to get to the Tachyon object directly; it looks like tachyon_repr
from parametric surface plots could be on the right track. I believe it returns the string representation of the corresponding Tachyon object. I don't see a function for building a Tachyon object from a string, but it must be easy.
In any case, I'm working on a project where I decided Tachyon is definitely the viewer I want, so I started constructing the Tachyon objects directly (as below). I've used parametric_plot
happily, and wasn't aware of problems with plot
until you pointed them out. As a workaround until someone gives a better answer, you could simply switch your plot
s to parametric_plot
s.
As for plot
, I noticed 3 problems:
sage: t = Tachyon(xres=512,yres=512, camera_center=(4,-4,3),viewdir=(-4,4,-3), raydepth=4) sage: t.light((4.4,-4.4,4.4), 0.2, (1,1,1)) sage: def f(x,y): return float(sin(x*y)) sage: t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.1, opacity=1.0, color=(1.0,0,0)) sage: t.plot(f,(-4,4),(-4,4),"t0",max_depth=5,initial_depth=3, num_colors=60) # increase min_depth for better picture sage: t.show()
For me, the following works fine (pink curve on a black background):
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)
On the other hand, the following seems to be broken (but not because of def
--note that I've changed that to a lambda
function); my guess is that the data file Tachyon is attempting to show is not formatted quite right:
sage: t = Tachyon(xres=512,yres=512, camera_center=(4,-4,3),viewdir=(-4,4,-3), raydepth=4)
sage: t.light((4.4,-4.4,4.4), 0.2, (1,1,1))
sage: f = lambda x,y : float(sin(x*y))
sage: t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.1, opacity=1.0, color=(1.0,0,0))
sage: t.plot(f,(-4,4),(-4,4),"t0",max_depth=5,initial_depth=3, num_colors=60)
sage: t.show(verbose=True)
tachyon /Users/niles/.sage//temp/soho.local/502//tmp_48.dat -format PNG -o /Users/niles/.sage//temp/soho.local/502//tmp_47.png ; rm -f "/Users/niles/.sage//temp/soho.local/502//tmp_48.dat"
Tachyon Parallel/Multiprocessor Ray Tracer Version 0.98
Copyright 1994-2007, John E. Stone <johns@megapixel.com>
-----------------------------------------------------------
Parse Error:
Encountered a syntax error in file /Users/niles/.sage//temp/soho.local/502//tmp_48.dat
Expected to find an object or other declaration
Actually found: (-3.8101867407915408,
Error occured at or prior to file offset 13733, line 326
Error position is only approximate, but should be close
Parser failed due to an input file syntax error.
Aborting render.