Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

finding rotations between two points on a plane

Please login with a confirmed email address before reporting spam

So I have the results of an eigenfrequency analysis, and would like to find out how much an object has rotated in a certain plane. For instance, in the picture below, I'd like to find out how much the front surface of the "red" block there has rotated in the y-z plane. I extracted the displacement data of the upper corners of the block, and used their initial positions to calculate the final position of each corner, and then use arc tan to find the angle. But I'm getting 45 degrees instead of approximately 0, as what the picture below indicates. What's wrong with my approach, or maybe anyone knows how to extract rotation of a certain plane directly (rotation of projection of the plane onto a plane on the yz axis) from COMSOL?



1 Reply Last Post 26 mai 2019, 16:26 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 26 mai 2019, 16:26 UTC−4
Updated: 5 years ago 26 mai 2019, 16:27 UTC−4

Hi,

That sounds like a mere trigonometry mistake. If you have the coordinates of: * O: the center of rotation * A: the initial point * B: the displaced point

then, assuming the rotation is around the x-axis

So to get the rotation angle, that is you can input in COMSOL

theta_A = acos((y_A - y_O)/R) * if(z_A > z_O, 1, -1)
theta_B = acos((y_B - y_O)/R) * if(z_B > z_O, 1, -1)
theta = theta_B - theta_A

Add this if R is not fixed by design

R = sqrt((y_A - y_O)^2 + (z_A - z_O)^2)

There might well be a more efficient way. Also, with these definitions and the same applies to so when you substract the two, the result might not be what you expect. Change > to >= for or add and a modulo operation to get

Hi, That sounds like a mere trigonometry mistake. If you have the coordinates of: * O: the center of rotation * A: the initial point * B: the displaced point then, assuming the rotation is around the x-axis R = ||\vec{OA}|| = \sqrt{(y_A - y_O)^2 + (z_A - z_O)^2} y_B = y_O + R \cdot \cos(\theta_B) z_B = z_O + R \cdot \sin(\theta_B) y_A = y_O + R \cdot \cos(\theta_A) z_A = z_O + R \cdot \sin(\theta_A) So to get the rotation angle, that is \theta_B - \theta_A you can input in COMSOL theta_A = acos((y_A - y_O)/R) * if(z_A > z_O, 1, -1) theta_B = acos((y_B - y_O)/R) * if(z_B > z_O, 1, -1) theta = theta_B - theta_A Add this if R is not fixed by design R = sqrt((y_A - y_O)^2 + (z_A - z_O)^2) There might well be a more efficient way. Also, with these definitions \theta_A \in [-\pi;\pi[ and the same applies to \theta_B so when you substract the two, the result might not be what you expect. Change `>` to `>=` for \theta_A \in ]-\pi;\pi] or add 2 \pi and a modulo operation to get \theta_A \in [0;2\pi[

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.