? How to add points of interest (Hotspots) to VTK

I would like to add some logic to my 3d models, by clicking on some colored balls that are scattered around the model.
The functionalities should include:

Zooming to a certain section of the model
Displaying some information about the model or a sub-section of it
Making some calculations (Like the volume, dimentions etc…)

Is this is possible ? if yes how can I do that, as I didn’t find anything that would help in the documentation.

Note: I’m using VTKjs with React

Thanks in advance

Yes you can do all that.
“Zooming” is done via the interactor style
“Displaying” some information is done via picking and your GUI
“Calculations” depends on what you want to do. As of now, it is not possible to compute the volume of a mesh (vtkMassProperties in VTK C++). Some filters would need to be rewritten to JavaScript.
Regarding the dimensions, you can get the “bounds” of a vtkPolyData.

Finally, for the colored balls, you can look at the “widgets”. Maybe PolyLineWidget (and hiding the line between each handle) should do the work.

Thank you very much for your reply, but I think that you miss-interpreted what I meant (Or probably I phrased it poorly).
I want all those actions to be triggered by pressing a colored ball on the model.
For example, let s assume we have a colored ball in the entrance of a 3d house, when you click on it, it goes to the kitchen and resets the zoom for example

Gotcha.

You then need to extend the PolyLineWidget to do what you want. That way you would place the balls (1 handle per handle), observe the “click” event (observe the ModifiedEvent on the widget state + check the active state flag), and on click, you modify the renderer active camera position…

1 Like