Rotation matrix of ligand in vmd - euler-angles

I am trying to get rotation matrix of ligand to find Euler angles using VMD software. Using measure inertia command I can get principal axes of rotation. How can I form rotation matrix from normalized principal axes? In one paper I found that some solution related to ordering Eigenvalues of the moment of inertia tensor. Also when I form rotation matrix using principal axes as columns, in some cases I get the matrix with determinant -1 ( it should be 1 for proper rotation matrix). How to deal with such improper rotation matrices to get Euler angles?

Related

What would the rotation vectors be for a torus using simple toroidal coordinates (toroidal and poloidal coordinates)?

https://en.wikipedia.org/wiki/Toroidal_and_poloidal_coordinates
For example, I see there are the basic rotation matrices for each axis shown in 1 but how would I find that in toroidal coordinates?

Covariance matrix after rotation

I encountered this question when developing a Kalman filter for a moving target using a camera on a drone. The problem is:
Assume I have a position measurement p1 with covariance matrix R1. And I have another rotation which is in the form of a quaternion q. This quaternion has a covariance matrix R2. Then what is the covariance matrix after I rotate p1 by q?
I have googled for a very long time but could only find the solution when q is a constant.
You can use propagation of uncertainty by numeric formula
https://en.wikipedia.org/wiki/Propagation_of_uncertainty
Using numeric derivatives (Jacobian)
Use MRPT implementation https://www.mrpt.org/
as described in here http://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf

How to calculate an angle from a rotation matrix

I have a given 3x3 rotation matrix and I want to calculate the rotation angle around z axis. How do I get there?
For example, in this case below, how did they calculated the "-30deg rotation around the x axis"? Or how did they get to the "-74deg" value around that axis?
This is my original matrix:
Thank you!
It is simple if the rotation matrix is just a rotation matrix and there is no scaling. Here is a site that explains in more pretty terms then I am willing to diagram here. Basically the rotation matrix is composed of sinf(x) and cosf(x) of euler angles (well you can think of it like that at least). You can therefore use values within it to back calculate the euler angles.
http://nghiaho.com/?page_id=846
If you have scaling involved you will need to normalize each row of the matrix first. Then apply the above method.

Difference Between Combining Quaternion Rotations and Rotation Matrices

Is the result of combining two quaternion rotations the same as that of two matrices and then converting that into a quaternion?
I have a quaternion (q1) and rotation matrix (m2) as input for a function (unfortunately non-negotiable) and would like to rotate the initial quaternion by the matrix resulting in a new quaternion. I have tried a fair few ways of doing this and have slightly bizarre results.
If I convert q1 into a matrix (m1), calculate m2.m1 and convert the result into a quaternion I get what is a likely quaternion result. However if I convert m2 into a quaternion using the exact same function and multiply those together (in both orders, I know it's non-commutative) I get something entirely different. I would like to realise the quaternion combination so that I can eventually SLERP from the current quaternion to the result.
All functions have come from here: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm and are being implemented in c++ and mathematica to test
There is an exact correspondence between 3x3 rotation matrices and unit quarternions, up to a sign change in the quarternion (the sign is irrelevant when in comes to performing rotation on 3D vectors).
This means that given two quarternions, q1, q2, and their corresponding matrices, m1, m2, the action of the quarternions on a vector v is the same as the action of the matrices on v:
q2*(q1*v*(q1^-1))*(q2^-1) = m2*m1*v
If your program does not achieve this result with an arbitrary vector v, there is likely an error in your formula somewhere.

How to get angle rotated of a 3D object from its transform martrix

I have a 3d object which is free to rotate along x,y and z axis and it is then saved as a transform matrix. In a case where the sequence of rotation is not known and the object is rotated for more than 3 times (eg :-if i rotate the object x-60degress, y-30 degrees, z-45 degrees then again x->30 degrees), is it possible to extract the angles rotated from the transform matrix?.I know that it is possible to get angles if the sequence of rotation is known, but if I have only the final transform matrix with me and nothing else, is it possible to get the angles rotated(x,y,and z) from the transform matrix ?
Euler angle conversion is a pretty well known topic. Just normalize the matrix orientation vectors and then use something like this c source code.
The matrix is the current state of things it has no knowledge of what the transformation has been in the past. It does not know how the matrix was built. You can just take the matrix into and decompose it into any pieces you like, as long as:
The data do not overlap. For example:Two X turns after each other is indistinguishable form each other (no way to know if its 1 2 or three different rotations summed).
The sequence order is known
A decomposition can be built out of the data (for example scale can be measured)

Resources