On Nov 27, 2007 9:13 AM, Leif Hille <> wrote: > William - > > REF: http://sagetrac.org/sage_trac/ticket/799 > > I dunno if this is the right way to comment on bugs however, I ran into the > same problem as the ticket's author. This "bug" ticket is part bug, part > user error (or poor documentation).
Hi, I've added your comments below to the above trac ticket. They will be very very helpful when we fix #799 (perhaps on bug day this Saturday...?) Thanks! > > (1) The user error part: In order to create a texture using a number other > than zero, you have to pass in a .texfunc() object. > > (2) The bug part: There is a problem with the plot/tachyon.py function that > prevents additional key parameters from being passed in. > > Explanation: > t.texture('grey', color=(.5,.5,.5), texfunc=0) --> this works > t.texture('dk_grey', color=(0.8,0.8,0.8),textfunc=1) --> this causes > subsequent t.show() command to fail. > > Solution: > (1) While the t.texture(...) function allows for 'texfunc=0' as an argument, > for any number greater than 0, it expects a texfunc object. > > ie: > r=t.texfunc(2) > t.texture('grey', color=(.5,.5,.5), texfunc=r) > > This is not evident from the inline help & the interface doesn't complain > when it's passed bad input - it just fails when t.show() is called (verbose > mode reveals the tachyon parser's complaints). > > (2) The bug is that some of the predefined numbered textures require > additional string input (eg. a file name for a texture map image/data) > immediately after the texture number. The texture number is passed in as a > number. I've made a workaround, making the "type" parameter into a > string(see changes below), allowing for filenames to be specified when the > texture number calls for it. This is still a little troublesome in that > because it's not obvious to me how to reference filenames of graphics > created within Sage (maybe there should there be a toplevel "fileref" method > to get a filesystem path reference to existing graphic image or dataset). > The same filereference problem presents if the user wants to use another > graphic or datafile as a texture map. > > ##from : .../plot/tachyon.py... > class Texfunc: > def __init__(self, type=0,center=(0,0,0), rotate=(0,0,0), scale=(1,1,1)): > self._type = type > self._center = center > self._rotate = rotate > self._scale = scale > > def str(self): > if type == 0: > return "0" > # Old Code > # return """%d center %s rotate %s scale %s"""%(self._type, # > <-- number > # >tostr(self._center), > # >tostr(self._rotate), > # tostr(self._scale)) > # new code: > return """%s center %s rotate %s scale %s"""%(tostr(self._type), > # <-- string > >tostr(self._center), > >tostr(self._rotate), > tostr(self._scale)) > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---