[vtkusers] question about implementing my own image pan

Jonathan Morra jonmorra at gmail.com
Fri Oct 15 12:18:31 EDT 2010


Thanks for the help.  I changed my implementation of panning to be from
screen to world coordinates and it works perfectly.  I tried to use the
built in panning with shift+left click and it works terribly for me, but my
version works perfectly.

Thanks again for the help

On Thu, Oct 14, 2010 at 7:08 PM, Jim Peterson <jimcp at cox.net> wrote:

> Jonathan Morra wrote:
>
>>
>> Where lastPoint[] is the last point that the mouse was at, and the
>> startPoint(e) method updates the lastPoint array.  This code does pan the
>> image in the direction that the mouse moves, however the amount that is
>> panned per mouse movement is wrong, and it seems to be affected by the image
>> zoom (ie an image that is zoomed in very far pans too fast and an image that
>> is zoomed way out pans too slowly).  Does anyone have any idea why this is
>> or how to fix it.  My guess is that I have to multiply the xChange and
>> yChange by some scale factor that's a function of the zoom, but I can't seem
>> to figure it out.
>>
>>
> I think you have the problem, you are using screen coordinates to modify
> world coordinates. when you are viewing a large scale object (zoomed out)
> the screen coordinates may be insignificant compared to the world
> coordinates, when zoomed in, they are very large. you might be able to
> factor the adjustment of the camera and focal point  to the distance between
> camera position and focal point (call that camera distance) to come up with
> a reasonable metric, maybe equate this screen width in pixels to camera
> distance in world units.
>
> Also, you are assuming your views are always perpendicular to a coordinate
> plane, are you allowing scene rotation? if so, your view plane may not be
> parallel to one of the coordinate planes.
>
> Just a curiosity, when I hold the shift key down, my window interactor goes
> into pan mode. If you need something different then that, maybe looking at
> the existing interactor  for an example of panning.
>
> HTH,
> Jim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101015/878c9fa3/attachment.htm>


More information about the vtkusers mailing list