SetOrigin do not work for actor with trackball interactor style

I am using vtkInteractorStyleTrackballActor with Spin method.

For Spin method, the actor would rotate along the actor center.

How can I change the rotation center? Does actor.SetOrigin work? The explanation of SetOrigin is:

Set/Get the origin of the Prop3D. This is the point about which all rotations take place.

However, when I use actor.SetOrigin, the Spin still rotate along the actor center.

The demo code is:


import vtkmodules.all as vtk

cylinder = vtk.vtkCylinderSource()
cylinder.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(cylinder.GetOutput())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

bounds = actor.GetBounds()
xmin, xmax, ymin, ymax, zmin, zmax = bounds
actor.SetOrigin(xmin, ymin, zmin) ############################# change the origin
render = vtk.vtkRenderer()
render.AddActor(actor)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(render)
renWin.Render()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballActor())
iren.Initialize()
iren.Start()

Use ctrl+left mouse press and move to trigger Spin method.

Any suggestion is appreciated~~~

Hello,

What happens if you do actor.SetOrigin(1000, 1000, 1000)?

best,

Paulo

It still rotate along the actor center even using actor.SetOrigin(1000, 1000, 1000) when spin.

Ok. Please, add a 2nd actor with origin at (100, 100, 100), perform a rotation and report the result here.

The 2nd actor is:

cone = vtk.vtkConeSource()
cone.SetCenter(3, 3, 3)

After coneActor.SetOrigin(100, 100, 100), the coneActor and cylinderActor always rotate along each actor center when spin happen.

Then I believe you need to use SetCenter() to achieve the effect you want.

But vtkActor do not have SetCenter method.

Hello,

I meant this:

Right?

best,

Paulo