Problem about revolution and rotation(just like earth and sun) using Actor->SetOrigin(X,Y,Z)

I am working on a school project about using VTK to draw a roller bearing. As you know, when the bearing is rotating, the roller is similar to pure rolling, it can be shown as rotation and revolution of the roller around the origin (0,0,0).

I modified the VTK sample ’ VTKExamples/site/Cxx/Animation/RotatingSphere’, trying to do this rotation and revolution, but I failed several times. From the user’s guide and my experiments, it shows out that SetOrigin will be done first, wherever it is, like this sample:

if (TimerCount < 180)
Actor4->SetOrigin(0, 0, 3.75);
Actor4->SetOrigin(0, 0, 0);

The origin will go (0,0,3.75) first and then go to (0,0,0), after the origin moving, it will rotate around (0,0,0), the origin now, and do order RotateY(4) and RotateY(1).

I want to know how to deal with this problem, make the roller rotation and revolution at the same time.

@xjtu_lxj You will need to build a vtkTranform rather than setting the actor’s member data. Transformations in VTK are very powerful but tricky to use. I suggest you read this Section on Transformations in Chapter 3 of the VTK Textbook. Also, Assemblies and Other Types of vtkProp.

I’ve tried this before, however, the class vtkTransform doesn’t include a member that can change the origin of the rotation, like SetOrigin.

Please read the Transformations section I linked to above. t shows how to implement the origin with a series of transformations.