For a standard 4x4 affine transformation, when converted to rotational angles and translation vectors, the order of the operation matters and is usually specified (e.g. rotate around z first, and then y, and then x, and then finally translate).
My short question would be that I have a 4x4 affine transformation matrix for rigid body transformation, and I would like to know how I should convert that to the input of translate/rotate in the Transform filter.
Or, if the question above is too vague, may I ask:
- Do we use Euler angles to rotate first, and then translate?
- Do we use axis angles to rotate, and then translate?
- Is it a different way to parameterize?
Any help would really be appreciated.
Well, the answer is it depends on which transformation filter you are using. ParaView exposes many VTK filters through the GUI, and you can find the implementation details in the source code. For instance, vtkTransform.h is a good start point. Typing
find . -iname "*transform*" in the paraview source code would give you a lot of transformation related filters. By doing so you can check your target filter.
Or you can test it through ParaView by applying a unit transformation several times. It should not be hard to judge from the result.
So maybe a more useful answer: If you are using ParaView’s defualt ‘Transform’ filter then I know the rotation is applied before the translation. There is an order for the Euler angles, but I can’t remember what it is.
Sorry, there are different ways to parameterize if you are in the code, but only euler angles + translation are exposed in the UI.
Thank you @Haocheng_Liu and @shawn.waldon! Your answers are very helpful.
I was surprised when Haocheng mentioned that there are many transformation filters (because you said “which transformation filter I am using”) when I only saw one; and then I read Shawn W’s answer that most of them are exposed via code rather than GUI. In that case I will dig more into the code then!
My experiment shows that the default ‘Transform’ is doing all translations in the order of the GUI: X-Y-Z translation and then X-Y-Z rotation. In addition, the base coordinate system of the rotation follows the transformations per step (e.g. the center of rotation will translate X-Y-Z and then rotate X-Y-Z) as well, which makes it quite complicated for my use case.
My task is where I would like to animate an object going through a series (e.g. 100) 4x4 affine transformations sequentially. It seems like I definitely can find ways to apply 4x4 transformations in the code; the task now is to figure out how to animate them via the appropriate API.
I’ll keep digging in and report back - in the mean time, any hints on which piece of code would be related will be helpful as well!
@yw5aj did you manage to express paraview’s translation/rotations as a “standard” 4x4 transform matrix?