As we know, vtkTransformFilter can change points’ positions and rewrite data. Then we use vtkTransform object to do linear transform for 3D model. This process is not equal to the multiplication of these two matrices.

We can deduce the event in our online tool: 3D Model Editor.
Open module linear transform tester.

We rotate the cone 45 degrees aroud Z axis firstly and rotate it 45 degrees around Y axis.

The second Y axis direction is not (0, 1, 0) because we have changed the status of cone. The right the multiplication of matrices need to be

``````R(45, 0, 0, 1)
R(-45, 0, 0, 1)
R(45, 0, 1, 0)
R(45, z0, z1, z2)``````

Rotate the cone back to the initial status and then apply the second matrix. Finally, compute the new Z axis direction after `R(45, 0, 1, 0)`, we get (z0, z1, z2), then apply `R(45, z0, z1, z2)` to the cone.

The whole matrix multiplication process is equal to

``````Matrix1 = R(45, 0, 0, 1)
vtkTransformFilter  filter
filter.SetUserTransform( Matrix1 )
filter.SetInputData( cone )
filter.Update()

cone = filter.GetOutput()
Matrix2 = R(45, 0, 1, 0)
vtkTransform trans
trans.SetMatrix( Matrix2  )

coneActor.SetUserTransform(  trans )``````
Categories: MathVTK

Article Rating
Subscribe
Notify of