I am trying to raise an event in C# using VTK when I clicked in a sphere
How can I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First you have to implement a custom InteractorStyle. Inside it’s OnLeftButtonDown(), you have to use a Picker, and then the ->GetActor() function of the picker will tell you which object you picked. If this object equals the object you were looking for, you now have the condition in which you have clicked your sphere and can do whatever you want.
(Here is a shell of this sort of situation (it doesn’t check which object you clicked, but shows how to subclass the InteractorStyle and use the Picker): http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/Picking