[vtkusers] Restricting movement of vtkSphereWidget/vtkLinkeWidget

Karthik Krishnan karthik.krishnan at kitware.com
Tue Sep 9 12:22:39 EDT 2008


Matthias Riechmann wrote:
> Hi,
>
> I'd like to restrict the movement of a vtkSphereWidget/vtkLinkeWidget. 
> Currently I'm using a vtkCallbackCommand to to get observe the 
> movement. In callback method I read the widget's position, adjust it 
> to a valid value and set the widget's position afterwards to the 
> calculated value. The result works in principal but the visualisation 
> is a very bad because the widget is drawn first on the originally 
> moved position and on the corrected position afterwards. Is there a 
> way to guarantee a rerender only after the correction of the position?
The HandleWidget and the contour widgets use PointPlacers in VTK now. 
The PointPlacer framework allows you do is to specify if a 2D display or 
a 3D world position is a valid location. It is extensible in the sense 
that you can write your own point placer deriving from vtkPointPlacer. 
As examples, I would recommend looking at

TestSurfaceConstrainedHandleWidget - Restricts a handle widget to a 
polygonal surface
TestHandleWidget - Restricts a handle widget to the plane of implicit 
plane widget
TerrainPolylineEditor - restricted to the surface of a terrain.


Unfortunately only the handle and the contour widgets support the use of 
point placers at the moment.

The handle widget can take any polygonal shape. See the 
TestPolygonalRepresentationHandleWidget, where it takes the shape of a 
sphere, so it should serve as a drop in replacement for the sphere 
widget. You'll have to do some work on getting the line widget to work 
with the point placers though.

Hope this helps



>
> I'm using vtk 5.0.2 in a Qt application. Are there any solution for my 
> problem in the new vtk 5.2? I understand there are a lot of 
> improvements concerning the widgets.
>
>
> Matthias
>
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
Karthik Krishnan
R & D Engineer,
Kitware Inc,
Ph: +1 518 3713971 x119
Fax: +1 518 3714573




More information about the vtkusers mailing list