[vtkusers] How to generate a point in 3D and change its location through dragging

David Doria daviddoria at gmail.com
Fri Aug 26 11:53:27 EDT 2011


On Fri, Aug 26, 2011 at 10:53 AM, Xiaopeng Yang <yxp233 at postech.ac.kr>wrote:

> Hi David,
>
> Last time you sent me this example to change the location of a 3D point. In
> this example, I cannot rotate, translate the image through mouse event.
> Only
> thing that I can do is to drag the point to a new position. I found that
> using vtkInteractorStyleTrackballActor does not allow the default vtk
> interaction. So I changed it into vtkInteractorStyleTrackballCamera which
> allows the default vtk interaction. However, error occurred when I debugged
> the code. The error comes from " this->InteractionProp = this->MoveActor;":
> the InteractionProp is not a member of vtkInteractorStyleTrackballCamera.
>
> So what should I do to not only change the point location, but also rotate,
> translate, and zoom in/out the image?
>
> Thanks,
> Xiaopeng
>

I don't think there is a particularly nice solution. You could use this:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/StyleSwitch

to switch between TrackballCamera and TrackballActor. Then once you are in
TrackballActor mode, I would hold a key (i.e. control):
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/ShiftAndControl

to indicate that you want to override the functionality of the left mouse
button only when you have that key held down.

Good luck,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110826/def06670/attachment.htm>


More information about the vtkusers mailing list