I was asked, "What changes when the user zooms?" Basically it is
scene.mouse.camera, which gives read-only information on the current
location of the "camera". For example, mag(scene.mouse.camera-scene.center)
is the current distance of the camera from the spin center. In particular,
scene.range is not changed during a user zoom and continues to specify the
bounds for autoscaling should the scene change. Here is a little routine
that shows this as you zoom or spin:
from visual import *
sphere()
where = label(pos=(0,1.5,0))
rangeval = label(pos=(0,-1.5,0))
while 1:
m = scene.mouse.camera
where.text = '%0.1f, %0.1f, %0.1f' % (m.x,m.y,m.z)
rangeval.text = '%0.1f, %0.1f, %0.1f' %
(scene.range.x,scene.range.y,scene.range.z)
There doesn't seem to be any way to set the camera position directly by
program. The only thing you can do by program is set the range, which has a
similar visual effect.
My head hurts slightly whenever I think about this, and I might not be
describing the situation quite right!
Bruce
|