On Sat, 2004-08-07 at 12:41, Joel Kahn wrote:
> Jonathan Brandmeyer asked for details on bugs I've
> found in the new helix function. Here goes.
>
> When I ran the following code . . .
>
> from visual import *
> hlx = helix (pos = (-0.5, 0.0, 0.0), radius = 5.0,
> coils = 20.0, thickness = 0.6, color = (0.99, 0.01,
> 0.9))
>
> . . . I got a tightly wound tall skinny purple helix.
> On the other hand, when I ran this . . .
>
> from visual import *
> hlx = helix ()
> hlx.pos = (-0.5, 0.0, 0.0)
> hlx.radius = 5.0
> hlx.coils = 20.0
> hlx.thickness = 0.6
> hlx.color = (0.99, 0.01, 0.9)
>
> . . . I just got a plain loose gray helix. The only
> attribute that changed from the basic defaults was the
> position. The two programs should, in principle,
> produce identical results. The new version of VPython
> still seems to do on-the-fly changes to older objects
> perfectly well; as far as I can tell, the helix is the
> only place where this problem shows up.
>
> In a separate experimental program, I attempted to
> apply the "object.rotate" function to the helix, and
> got an error message telling me that the helix does
> not have the "rotate" attribute. If the helix is
> derived from the "curve" object--as it visually
> appears to be--then this makes sense, and we might
> have to stick with using a frame to rotate a helix.
The helix object is a curve within a frame. The class only inherits
from 'object' (the Python pseudo-type), and wraps around the frame and
curve objects.
However, those are just implementation details. The helix tries to look
like it 'is a' curve object rather than 'has a' curve, so the next
revision will make those true properties rather than just constructor
parameters. If you look at site-packages/visual/primitives.py, you will
see what I mean. If you would like to write a patch that adds those
attributes, it would be accepted. Most of the work would be to simply
forward the property change to whatever member (the underlying frame or
curve) needs it.
Thanks for the feedback,
-Jonathan
|