lorensen / VTKExamples

The VTK examples, formerly hosted on media wiki
Apache License 2.0
342 stars 157 forks source link

Some questions about Cellpicking #631

Closed hisupersylar closed 3 years ago

hisupersylar commented 4 years ago

recently i rewrite the cellpicking example,i can pick vertex, line,plane. in this example, it create only one plane with triangle filter what i rewrite contains as followed: A. i create a plane,using four points. B.then I create three vtkCellArray with the above four point,contains the line,vertex,and the polygon(the plane). C.at the creation of vtkPolyData, i call the member function of vtkPolyData to set the line,vertex,and the plane. the functions are setpoints,setlines, setverts,and the setpolys. D.In the rewrite class MouseInteractorStyle, i set the point size of selected. after above,i can pick the point,line and plane. everything looks well.

then i want to move one actor Individually. but the MouseInteractorStyle Derived from the vtkInteractorStyleTrackballCamera class.

default, when we use the vtkInteractorStyleTrackballCamera style, i move one actor by the mouse,all of the actor in the scene move. so i see that ,the vtkInteractorStyleTrackballCamera class only can move the scene,it can't move the one actor Individually. then i see the vtkiteraactorStyleTrackballActor class, it can help me . when i change the parent class to the vtkiteraactorStyleTrackballActor ,it works. but ,something unexcepted happened:

in the OnLeftButtonDown function, it create new actor to show in the actor.

so i have some questiones:

in the OnLeftButtonDown function, is there some methods to avoid create the actor. because i move the actor of selected,the actor of the created will show. so ,i confused.

ajpmaclean commented 4 years ago

Just guessing but I suspect you have just one actor. Look at MoveActor.

hisupersylar commented 4 years ago

Just guessing but I suspect you have just one actor. Look at MoveActor. in the OnLeftButtonDown method, it pick the cell(vertex,line,plane) and highlight the picked cell, the method the demo used is create a new actor(point,line,plane) which is the cell picked at the mouse postion. i think the method is not good.

hisupersylar commented 3 years ago

close

ajpmaclean commented 3 years ago

For your reference. This site is no longer maintained as the owner has died. The examples have been re-worked and moved to a new site: vtk-examples