There are a lot of concepts in VTK, but they are well organized! I really recommend getting comfortable with the main ideas by reading at least the summary chapters within the manuals, which you can find for free here: VTK Textbook and User's Guide now available for download - Kitware Blog
Thank you for the quick answer and the explanations !
Good advice for the book yes !
Regarding the codepen you provided, I think we have the same: the getCenter() is not updated if we log it.
getPosition() seems really the way to go, but on our real life case, it does not seem to be in ‘world coordinates’, that why I tried getCenter().
I try to dig a bit more about why on this example getPosition() and getCenter() (when interactor updates the view) are the same, and not on our case (a bit more complicated, with multiple actors).
That’s certainly another point where I am a bit lost because I have to gain more knowledge of VTK concepts: getBounds() should be called on the mapper or the source ?
Anyway, in the codepen provided by Drew, if I add those two lines to the slider callback:
actor.getBounds() seems to do what I want, you are right, it is in our case in world coordinate,
and is updated as soon as actor.setPosition(x, y, z) is called.
I still don’t get what does actor.getCenter(), I will look into the source code.
Also, I have also to look why, in our code, actor.getPosition() gives something really different than the world positions.
Anyway I think we can proceed and this case is solved, thank you all !
Think of your data as already having some bounds (from the points in the file/source etc)
Then setPosition can be thought of as it if were setting a translation. What it does is set a translation that will be applied to the original data when rendered. Using a 1d example, if your original data has bounds of 10 to 20 and you did set position of 5 the new bounds would be 15,25 Hope that helps.
Thank you Ken, it helps a lot ! Now I think I really understood why in our case getPosition() (the translation) gives a different result than getBounds() (the world position), even if both are in world coordinates.
and in our code, it happens that adding a call to getBounds() before getCenter() makes getCenter() to be updated (without having to interact with the view).
You are right Drew, and the comments here are pretty clear !
// Check if we have cached values for these bounds - we cache the
// values returned by model.mapper.getBounds() and we store the time
// of caching. If the values returned this time are different, or
// the modified time of this class is newer than the cached time,
// then we need to rebuild.