[vtkusers] How to move points interactively, vtkHandleWidget

Dirk Fressmann dirk.fressmann at dynamore.de
Fri Oct 17 11:47:49 EDT 2008


Oh thanks that helped :-) I figured out how to use it and got the sphere 
on the screen. But how do I get the new position (after translation) in 
world coordinates?

Thanks in advance
Cheers Dirk



Karthik Krishnan wrote:
> On Fri, Oct 17, 2008 at 10:24 AM, Dirk Fressmann
> <dirk.fressmann at dynamore.de> wrote:
>> Hey Guys,
>>
>> I have a vtkUnstructuredGrid defined and want to be able to mousepick
>> certain nodes to move them in space. I found two possibilities:
>> - vtkPointWidget
>> - vtkHandleWidget/vtkPointHandleRepresentation3D or
>> vtkSphererHandleRepresentation.
>>
>> Especially since I want to highlight those points, which can be moved by the
>> user, I think the latter one is the best method. Unfortunately I can't find
>> any information or examples about this
> 
> Did you take a look at the VTKTests.
> 
> Specifically the following two tests are the examples you are
> looking for:
> 
>   TestSphereHandleWidget.cxx
>   TestHandleWidget.cxx
> 
> 
>> and I don't see any effects if I do
>> something like this (python)
>>
>> vtkHandleRepr = vtk.vtkSphereHandleRepresentation()
>> vtkHandleRepr.SetWorldPosition([0.0,0.0,0.0])
>> vtkHandleRepr.SetHandleSize(5.0)
>> vtkHandleRepr.SetSphereRadius(5)
>> vtkHandleRepr.ActiveRepresentationOn()
>> vtkHandleRepr.SetRenderer(ren)
>>
>> vtkHandle = vtk.vtkHandleWidget()
>> vtkHandle.SetRepresentation(vtkHandleRepr)
>> vtkHandle.SetInteractor(iren)
>>
>> # callback function
>> def _testit(object,event):
>>    print "hello"
>> vtkHandle.AddObserver("LeftButtonPressEvent", _testit)
>>
>> or c++
>>
>>  vtkSphereHandleRepresentation *handleRep =
>>    vtkSphereHandleRepresentation::New();
>>  double pos[3] = {0.0, 0.0, 0.0};
>>  handleRep->SetWorldPosition(pos);
>>  handleRep->SetPlaceFactor(2.5);
>>  handleRep->SetSphereRadius(5.0);
>>  handleRep->PlaceWidget(vtkActor[1]->GetBounds());
>>  handleRep->ActiveRepresentationOn();
>>
>>  vtkHandleWidget *handleWidget = vtkHandleWidget::New();
>>  handleWidget->SetInteractor(iren);
>>  handleWidget->SetRepresentation(handleRep);
>>
>> where there should be at least a sphere at position (0,0,0).
>> Anyone any ideas or experiences with this?
>>
>> Cheers Dirk
>> _______________________________________________
>> 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
>>
> 
> 
> 

-- 
DYNAmore - Gesellschaft fuer Ingenieurdienstleistungen mbH
Dirk Fressmann, Dr.-Ing.
Industriestrasse 2
D-70565 Stuttgart-Vaihingen
--------------------------------------------------------------------
Tel             +49 (0)711 - 45 96 00 - 23
Fax             +49 (0)711 - 45 96 00 - 29
E-Mail          dirk.fressmann at dynamore.de
Internet        www.dynamore.de



More information about the vtkusers mailing list