I’m new to VTK and I’m struggling to understand what setOrigin and setPosition mean in vtk3DProp. I’m trying to display multiple cubes ( with specific x, y, z lengths and x, y, z co-ordinates with labels) using vtkAnnotatedCubeActor. Unlike vtkCubeSource, I cannot specify a center or x, y, z lengths for vtkAnnotatedCubeActor. As I understand I can use SetOrigin, SetPosition and SetScale to achieve the result I want but I’m failing to understand how these map to each other. Can anybody explain these to me ? Any help is greatly appreciated !
My two cents: setOrigin() sets the object’s origin with respect to the world whose origin is 0,0,0. setPosition() sets the postion of the actor with respect to its origin. setOrigin() is very useful if your model has local coordinate systems.
For example, suppose you’re modeling the Solar System. You place the Sun actor at origin=0,0,0 and position=0,0,0 so it occupies the center of the Solar System. Then you place the Earth actor 150 million km away from the Sun, but you make Earth’s origin at the Sun because the former orbits the latter: origin=0,0,0 and position=150000000,0,0. Then you place the Moon actor with respect to the Earth, not the Sun and 400,000km away from the Earth: origin=150000000,0,0 and position=300000,0,0. This way, you don’t need to make complicated computations to make the Moon orbit the Earth while it orbits the Sun with only global heliocentric coordinates.
setScale() will scale the XYZ values of the actor with respect to its origin. In the example above, if you apply a 2x,2x,2x scale to the Moon actor, it will double in size and end up twice further away from the Earth.
I hope this helps casting some light on the subject.