From: Kadir H. <kha...@ya...> - 2009-06-12 16:19:22
|
Hello All, I am trying to Zoom-In / Zoom-Out under program control. By changing scene.center vector, it looks like we get the zoom effect working OK. However, if we have any large object in the "space" (i.e., not necessarily in scene/display), the behaviour gets somewhat corrupted. The zoom depth is decreased and objects start to get lost as we zoom in. The interesting thing is that the userzoom (manual zoom) works OK even if you have the same large object around. Another funny behaviour is that, after program controlled zoom with large object around, the manual zoom also seems to be somewhat affected. Any idea on how userzoom normally works and prevents such problems to occur? I tried to observe any differences in scene.mouse.camera, scene.range, scene.fov behaviour for two different cases, but noticed nothing meaningful. It must be something like scene.depth, which does not exist (at least explicitely as far as I know), which gets changed with the existance of a large object. Kadir Here is my small Zoom Test code to see two differnt behaviour: ## ZOOM TEST from visual import * scene.range = (5.0,5.0,5.0) LargeObject = sphere(pos=(-125.0,-95.0,-125.0), radius=125.0, color=(0.7,0.7,0.7), visible=0) cyl1 = cylinder(pos=(0,-0.5,0), radius=0.5, axis=(0,1,0)) box1 = box(pos=(1,0,1)) bal1 = sphere(pos=(-1,0,2)) def ZoomIn(): scene.center = scene.center+scene.forward*0.10 def ZoomOut(): scene.center = scene.center-scene.forward*0.10 i=0 while 1: i += 1 if 50 < i < 150: ZoomIn() # Zoom with LargeObject not visible if 150 < i < 250: ZoomOut() if i == 250: LargeObject.visible=1 if 250 < i < 350: ZoomIn() # Zoom with LargeObject visible if 350 < i < 450: ZoomOut() rate(25) |