|
From: Bruce S. <bas...@un...> - 2002-07-02 02:35:13
|
This looks like a bug to me, and I'll try to see whether it can be fixed
(assuming it's a bug, not a feature!). Here is a workaround, though it is a
workaround that will do the wrong thing in the future if the bug is fixed:
trail.color[:-1] = trail.color[1:] # move the colors down one slot to
compensate
trail.pos = trail.pos[1:] # delete first slot in the position list
Bruce Sherwood
At 02:20 PM 02/07/01 -0700, Bruce Peterson wrote:
>The VPython documentation discusses using the curve object to
>create trails for moving objects. The curve can also be used to record
>the history of an intrinsic parameter (such as temperature represented
>by object color) with code like:
> obj.pos=newpos
> obj.color=newcolor
> trail.append(pos=newpos, color=newcolor)
>However if an abbreviated history is desired then the code
> obj.pos=newpos
> obj.color=newcolor
> trail.append(pos=newpos, color=newcolor)
> if len(trail.pos)>maxlen:
> trail.pos=trail.pos[1:]
>
>correctly truncates the curve length but incorrectly truncates the color.
>Internally the curve object appears to implement:
>
> if len(self.color)>len(self.pos):
> self.color=self.color[0:len(self.pos)-1]
>
>Is there any known way around this so that colors remain correctly associated
>with position?
>
>BTW storing position and color in a seperate list and replacing the entire
>list on each iteration rapidly goes into memory management meltdown - it
>works for small examples but rapidly dies with larger examples.
>
>
>Bruce Peterson
>Terastat, Inc
>Information Access Systems
>Voice (425) 466 7344
>Fax (206) 350 3685
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Visualpython-users mailing list
>Vis...@li...
>https://lists.sourceforge.net/lists/listinfo/visualpython-users
|