def Pan(x,y)
if @CurrentRenderer
renderer = @CurrentRenderer
camera = @CurrentCamera
(pPoint0,pPoint1,pPoint2) = camera.GetPosition
(fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
if (camera.GetParallelProjection)
renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
renderer.WorldToDisplay
fx,fy,fz = renderer.GetDisplayPoint
renderer.SetDisplayPoint(fx-x+@LastX,
fy+y-@LastY,
fz)
renderer.DisplayToWorld
fx,fy,fz,fw = renderer.GetWorldPoint
camera.SetFocalPoint(fx,fy,fz)
renderer.SetWorldPoint(pPoint0,pPoint1,pPoint2,1.0)
renderer.WorldToDisplay
fx,fy,fz = renderer.GetDisplayPoint
renderer.SetDisplayPoint(fx-x+@LastX,
fy+y-@LastY,
fz)
renderer.DisplayToWorld
fx,fy,fz,fw = renderer.GetWorldPoint
camera.SetPosition(fx,fy,fz)
else
(fPoint0,fPoint1,fPoint2) = camera.GetFocalPoint
renderer.SetWorldPoint(fPoint0,fPoint1,fPoint2,1.0)
renderer.WorldToDisplay
dPoint = renderer.GetDisplayPoint
focalDepth = dPoint[2]
aPoint0 = @ViewportCenterX + (x - @LastX)
aPoint1 = @ViewportCenterY - (y - @LastY)
renderer.SetDisplayPoint(aPoint0,aPoint1,focalDepth)
renderer.DisplayToWorld
(rPoint0,rPoint1,rPoint2,rPoint3) = renderer.GetWorldPoint
if (rPoint3 != 0.0)
rPoint0 = rPoint0/rPoint3
rPoint1 = rPoint1/rPoint3
rPoint2 = rPoint2/rPoint3
end
camera.SetFocalPoint((fPoint0 - rPoint0) + fPoint0,
(fPoint1 - rPoint1) + fPoint1,
(fPoint2 - rPoint2) + fPoint2)
camera.SetPosition((fPoint0 - rPoint0) + pPoint0,
(fPoint1 - rPoint1) + pPoint1,
(fPoint2 - rPoint2) + pPoint2)
end
@LastX = x
@LastY = y
self.Render
end
end