Hi all,

I am working on a python script to rotate a slice in the x-y-plane and can't find a way to compute the parameters for the Transform filter.

The slice is computed by a script and is defined by the origin and the normal. It looks like this:

https://www.pic-upload.de/view-33136320/slice.png.html

The origin is (12.65, 10.55, 3.0)
The normal is (9.28454496846, -68.7942219477, 21.4027743404)
or (0.127811549959, -0.947024993173, 0.294631753216) if it is normalized.

Now I want to rotate the slice in the x-y-Plane, so that the normal of the rotated slice points in z-direction.

I tried to rotate the normal-vector with the rotation matrices ( https://en.wikipedia.org/wiki/Rotation_matrix ), but it does not work. The computed vector shows somewhere, but not in z-direction, when I set it in the Transform filter.

The right rotation input for the transform filter is approximately (-71, -19, 0) but I have no idea, how to get there by computation. The angle of the normal with the x-axis is about 82 degrees, with the y-axis about 161 degrees. I computed rotation_matrix_X and rotation_matrix_Y with the angles and multiplied:
rotated_normal = rotation_matrix_X * normal
rotated_normal = rotation_matrix_Y * rotated_normal

The result is (-30, -30, 59) which is far away from (-71, -19, 0).

What is the right way to compute the rotation parameters of the Transform filter out of the data of the Slice filter (Origin and Normal)?

Best Regards
Alexander

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to