|
From: Bruce P. <bap...@te...> - 2002-07-01 21:20:57
|
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
|