# Angular velocity from two Matrices

1. Sep 14, 2009

### brownmonster

Hi,

Currently i have a situation where I have two transformation matrices A and B (both 4x4). matrix A represents the transformation at time t=0 and matrix B represents the transformation at t = 1. I am wanting to calculate the angular velocity required to transform matrix A to matrix B, is this possible (on searching for this I can only seem to get back really complex answers and was hoping that it could be simpler than most results i have)

The application for this is that i have an animation system in my aplication, and i am wanting to populate some physics data based on the animation data this includes linear velocity and angular velocity, naturally linear velocity is rather easy as you can compute the delta and divide by the time step!

Can anyone provide me some pointers or a solution to this.. I was hoping it would be as easy as taking the matrices as 3x3's multiplying A by the transpose of B, to get the "delta" so to speak, and treating that as an angular velocity rotation matrix, but I can't see it being this simple!

Any help would be great!

Thanks!

Ste.

(Apologies for putting this in general physics, I posted from the wrong tab :(, Can it be transferred? )

Last edited: Sep 14, 2009
2. Sep 14, 2009

### brownmonster

Angular veloicty from two matrices...

Hi,

Currently i have a situation where I have two transformation matrices A and B (both 4x4). matrix A represents the transformation at time t=0 and matrix B represents the transformation at t = 1. I am wanting to calculate the angular velocity required to transform matrix A to matrix B, is this possible (on searching for this I can only seem to get back really complex answers and was hoping that it could be simpler than most results i have)

The application for this is that i have an animation system in my aplication, and i am wanting to populate some physics data based on the animation data this includes linear velocity and angular velocity, naturally linear velocity is rather easy as you can compute the delta and divide by the time step!

Can anyone provide me some pointers or a solution to this.. I was hoping it would be as easy as taking the matrices as 3x3's multiplying A by the transpose of B, to get the "delta" so to speak, and treating that as an angular velocity rotation matrix, but I can't see it being this simple!

Any help would be great!

Thanks!

Ste.

Last edited: Sep 14, 2009
3. Sep 14, 2009

### brownmonster

"Moved to general math"

Last edited: Sep 14, 2009
4. Sep 14, 2009

### arildno

Re: Angular veloicty from two matrices...

Rotations are nasty stuff, not the least how to define "angular velocity".

I advise you to look into the concept of Euler angles, for example at mathworld:
http://mathworld.wolfram.com/EulerAngles.html

5. Sep 14, 2009

### HallsofIvy

Re: Angular veloicty from two matrices...

This was also posted in the physics section so I am merging the two threads.

6. Sep 14, 2009

### John Creighto

Re: Angular veloicty from two matrices...

If A and B they rotation matrices why are they four by four?

7. Sep 14, 2009

### D H

Staff Emeritus
Last edited: Sep 14, 2009
8. Sep 14, 2009

### John Creighto

I was aware of that but it the transformation also contains a translation then it will be harder to find the rotational velocity. I don't think there was enough information given in the original problem to answer the question. For instance, is the rotation always about the same axis? You mentioned robotics, is this a robotics problem? If so, it would be helpful, to know something about the geometry of the robot.

9. Sep 14, 2009

### John Creighto

Given the original poster is looking for approximate methods, any rotation can be represented by the composition of three rotations, about a set of independent axis, since it is four by four I'll assume there is a translation in here:

$$C=B-A \approx \frac{dA}{d\theta_1}d \theta_1+\frac{dA}{d\theta_2}d \theta_2+\frac{dA}{d\theta_3}d \theta_3+\frac{d A}{d x_1}\d x_1+\frac{dA}{d y_1}\d_y_1+\frac{dA}{d z_1}\d_z_1$$

Now, equate terms in the two matricies and solve for,
$$d \theta_1, d \theta_2, d \theta_3, d x_1, d y_1, d z_1$$

Then to get angular velocities, divide the change in angle by the change in time. If more was known about the problem a more accurate answer could be given.

Last edited: Sep 14, 2009
10. Sep 14, 2009

### D H

Staff Emeritus
I am not the OP, John. I don't know the application.

That said, that the OP is using 4x4 matrices rather than 3x3 doesn't really matter. Just look at the 3x3 rotation matrix -- or transformation matrix (I don't know which the OP is using, and most authors are clueless to the fact that rotation is the transpose of transformation.)

Anyhow, R(t+dt)R(t)T is the rotation from time t to t+dt in the body frame at the t. This will be close to an identity matrix. The off-diagonal elements provide one source for estimating the angular velocity.

Note well: This has all the problems associated with numerical differentiation in general and also brings into play lots of numerical errors that result from computing the matrix product of a matrix and the transpose of another matrix that is very close to the first.

11. Sep 14, 2009

### brownmonster

Yeah the above method is what I did originally and I have ended up keeping, all other methods that i tried seem to work for 99% of cases, whereas this works for all case but is slightly erronous. I was wondering if anyone had any precise way of doing it :)...

And to clear it up i'm using 4x4 matrices as it is a translation and a rotation, I am only interested in the rotational components so i can simply take the 3x3 component of each matrix.

And to clea rup the application: We have animation data from objects and characters in our app, this information wants to feed into the realtime physics system so it can interact with the 1000's of objects that are in there correctly so characters can hit stuff around and move correctly on moving objects etc etc.

Thanks for the replies :)