CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Rotation of a slice

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2017, 09:43
Default Rotation of a slice
  #1
New Member
 
Join Date: Jan 2017
Location: Germany
Posts: 19
Rep Power: 9
beral is on a distinguished road
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 a Transform filter.

What is the right way to compute the rotation parameters of the Transform filter out of the data of the Slice filter?
beral is offline   Reply With Quote

Old   May 17, 2017, 12:28
Default
  #2
New Member
 
Join Date: Jan 2017
Location: Germany
Posts: 19
Rep Power: 9
beral is on a distinguished road
The Transform filter needs the rotation angles in degrees.

My Slice:
sliceclip0.zip

The Slice is defined by the Origin (12.65, 10.55, 3.0) and the Normal (9.28454496846, -68.7942219477, 21.4027743404)

The angles of the normal vector to the three axes are:
to x: 82.65685160236063 °
to y: 161.26691656998636 °
to z: 72.86454299732682 °

To set the slice in the xy-Plane, so that the normal shows in z-direction, it requires rotations around x and y axis, right? When setting the angles to x and y in the transform filter, the slice is still not in the xy-plane.

What is the problem with this method?
beral is offline   Reply With Quote

Old   May 29, 2017, 04:38
Default
  #3
New Member
 
Join Date: Jan 2017
Location: Germany
Posts: 19
Rep Power: 9
beral is on a distinguished road
If anybody else faces the same problem, here is a working solution:

Tho normal of the slice is a numpy array 'normal' with
normal[0] = x
normal[1] = y
normal[2] = z

First transform filter:
rotation angle around the x-axis = degrees(atan(normal[1] / normal[2]))

Then the normal has to be rotated also:
angle = atan(normal[1] / normal[2]) # rotation angle from the above
Rotation matrix around the x-axis = rotX = np.array([(1.,0,0), (0.,cos(angle),-sin(angle)), (0.,sin(angle),cos(angle))])
new_normal = numpy.dot(rotX, normal)

Second transform filter:
rotation around the y-axis = degrees(-atan(new_normal[0] / new_normal[2]))

It works. It is not possible to calculate both angles at once and put them in one transform filter. Between the calculation of the angles the normal has to be rotated.

There may be an issue with the sign (+/-) of the calculation formulas.
beral is offline   Reply With Quote

Old   January 16, 2018, 07:01
Default How did you find the angles of the normal vector to the three axes? Thank you.
  #4
New Member
 
Joao
Join Date: Nov 2017
Location: Campinas - SP
Posts: 3
Rep Power: 9
Joao_Z is on a distinguished road
Quote:
Originally Posted by beral View Post
The Transform filter needs the rotation angles in degrees.

My Slice:
Attachment 56086

The Slice is defined by the Origin (12.65, 10.55, 3.0) and the Normal (9.28454496846, -68.7942219477, 21.4027743404)

The angles of the normal vector to the three axes are:
to x: 82.65685160236063 °
to y: 161.26691656998636 °
to z: 72.86454299732682 °

To set the slice in the xy-Plane, so that the normal shows in z-direction, it requires rotations around x and y axis, right? When setting the angles to x and y in the transform filter, the slice is still not in the xy-plane.

What is the problem with this method?
Hi, I have maybe a dumb question, how did you convert the normal to angles?
Thank you
Joao_Z is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Macro -- Passive Pith in Superposing Rotation Motion Weidong Dai STAR-CCM+ 2 August 4, 2018 06:39
Remeshing for Rotation in CFX via ICEMCFD gera CFX 3 September 23, 2017 13:29
Fluent rp var to modify rotation speed of a boundary QBeast FLUENT 2 August 12, 2015 16:58
Extracting a non-uniform slice from a 3D geometry APSK Visualization & Post-Processing 1 October 30, 2014 16:56
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 07:21


All times are GMT -4. The time now is 19:44.