Two vtkSpheres are displayed in an actor, now I pick up a cell in vtkSphere, and then I need to highlight the selected vtkSphere.
- Change the polyData of the selected vtkSphere and assign different colors
- Build another actor and display wireframe of the clicked vtkSphere
Which solution is better? Or there are any better way?
Pick the one you feel good with, both seem good to me. In programming there is no such thing as “better way”, instead there are solutions well suited to your problem. For example, if you ask the community which is the best way to sort a list, other people will suggest fancy things you may not really need like heap sort when the humble, trusty, cheap-to-implement bubble sort will solve your little “sort 5-6 items in the combobox” like charm.
Trust your own solution will be good. It stimulates your creativity and develops confidence in yourself. If it doesn’t work as expected, don’t abandon it yet, then you seek more experienced users for fixes.
Well, answering your question, I’d favor your 1st idea as it doesn’t involve creating new objects. Just my two cents.
Thanks for your reply. It helps me a lot~