Object seems to shrink from one frame to next in animation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Object seems to shrink from one frame to next in animation

Damian Birchler
Dear list

I'm trying to do a visualization of a copper bar that's standing upright
and twisted counter-clockwise. I start from a iso-symmtric view of the bar
which has one of the long, vertical edges of the bar in the plot's center.
As the bar is being twisted however, it seems to shrink noticeably. I think
that this shrinking effect is an artifact of the visualization since I
wouldn't expect such large deformations. I save the view, roll and parallel
scale of the first frame and set them in the following frames like so:

        if i == 0:
            scene.scene.isometric_view()
            view = mlab.view()
            roll = mlab.roll()
            pos, focal, angle, scale = camera.position, camera.focal_point,
camera.view_angle, camera.parallel_scale
        else:
            #camera.position = pos
            #camera.focal_point = focal
            #camera.view_angle = angle
            mlab.view(*view)
            mlab.roll(roll)
            camera.parallel_scale = scale

I do this after the call to the plotting function. Finally, I save the plot
to a file. Can yo tell me what I'm doing wrong. Do I have to call some kind
of update function after setting the camera position?

I'm attaching to pictures of the plots so that you can see the shrinking
effect.

Thanks,
Damian

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Object seems to shrink from one frame to next in animation

Gael Varoquaux
On Mon, Apr 02, 2012 at 12:34:31PM +0200, Damian Birchler wrote:

>         if i == 0:
>             scene.scene.isometric_view()
>             view = mlab.view()
>             roll = mlab.roll()
>             pos, focal, angle, scale = camera.position, camera.focal_point,
> camera.view_angle, camera.parallel_scale
>         else:
>             #camera.position = pos
>             #camera.focal_point = focal
>             #camera.view_angle = angle
>             mlab.view(*view)
>             mlab.roll(roll)
>             camera.parallel_scale = scale

I wouldn't set the set of the camera, I would only control the parameters
of mlab.view and mlab.roll. I am afraid that you might be getting a drift
in camera distance, that you compensate with the scale.

That's just a wild guess, though,

Gael
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev