[vtk-developers] Widget picking interfaces only for mouse

Andrew Dolgert ajd27 at cornell.edu
Sat Dec 6 18:01:36 EST 2003


Hi-

I've been using VTK and its widgets inside a virtual reality environment
called a Windows CAVE.  I'm wondering whether anyone has thought of
generalizing events and picking from 2D mouse positions.  While
implementing widgets and picking for immersive environments, I've
noticed that 2D mouse (x,y) points are responsible for some redundant
code.

I don't mean to suggest sweeping changes.  I've implemented the methods
below because I had to for an immersive environment, and I see many
great new widgets are on the way.  I can translate them for my own use,
too, but I thought I'd share this idea.

Current state:
When the user moves the mouse, every widget separately converts mouse
movements to transforms in world space.  When the widget calls the
picker, the picker transforms the mouse x,y into a ray in world space so
it can find points near the ray.  All three pickers do this same
transformation, and it is of something already once transformed.  The
interface to vtkPicker::Pick(x,y,z,renderer) looks general, but it is
really, in the implementation, a mouse (x,y) and z=0.  Someone was
thinking it could be more general.

Suggestion:
If the interactor supplied a transform describing mouse motion, it would
support other devices like space mice, pinch gloves, and immersive
trackers.  In addition, widgets would not need to perform a conversion
to find the transform.

If the interactor supplied, and the picker accepted, a
vtkImplicitFunction describing the pick, it would reduce computation.
That function would, for a mouse pick, accept an (x,y,z) in world space
and return the distance from a ray starting at the screen, pointing in
the DOP.  For a pinch glove, that implicit function would measure
distance from the pinch point.  For an immersive wand, it would measure
distance from a line segment, the wand.

Besides picks and motion, mouse events are used for determining which
renderer was poked, but that function is now part of the Interactor, so
it could be performed efficiently for mice, where you need only the
(x,y) and correctly for immersive systems and display walls, where you
need to determine whether the wand's line segment intersects a
renderer's view frustum.

The current picking interface could stand, in case user's use it in
callbacks.  It would just create the implicit function and pass the job
on to the more general picker.

- Drew Dolgert, Cornell Theory Center




More information about the vtk-developers mailing list