comp sci balla
comp sci balla

Reputation: 823

Converting a 2D rotation matrix into a Euler angle

How do I convert a 2x2 rotation matrix into a Euler angle? The rotation matrix is:

{{.46, .89}, {.89, -.46}}

Wikipedia instructs me that a 2D rotation matrix takes the form:

{{cos(a), -sin(a)}, {sin(a), cos(a)}}

Knowing that

{{cos(a), -sin(a)}, {sin(a), cos(a)}} = {{.46, .89}, {.89, -.46}}

I computed

{{inverseCos(a), -invereSin(a)}, {invereSin(a), inverseCos(a)}}

to get (these values were converted to degrees)

{{62.3, -62.3}, {62.3, 117.8}}

What am I supposed to do with these numbers? Aren't they supposed to be equal? The universe no longer makes sense to me.

Upvotes: 2

Views: 3620

Answers (3)

Troubadour
Troubadour

Reputation: 13431

Your matrix is not a pure rotation. The first and last entries are the negative of each other and so can't possibly both be equal to the cosine of some angle.

Looks like you actually have a scale matrix multiplied in there too of the form

{{1, 0}, {0, -1}}

Edit:

From wikipedia:

In this case, the diagonal matrix Σ is uniquely determined by M (though the matrices U and V are not).

In your wolfram example both U and V have a scale matrix of {{1,0},{0,-1}} in them which of course cancel out to leave pure rotation matrices. My understanding is that these would be a valid choice of U and V too i.e. the decomposition is not unique.

Upvotes: 4

hc_
hc_

Reputation: 2628

It came from a singular value decomposition courtesy of wolfram

An SVD gives you two orthogonal matrices (and the diagonal matrix of eigenvalues, of course). Rotation matrices aren't the only orthogonal matrices. A rotation and subsequent a "flip" (scale by -1 on one axis) is orthogonal, too. If you want to get a rotation matrix from an SVD, you have to check for a flip and flip the matrix back in that case.

Upvotes: 1

SJuan76
SJuan76

Reputation: 24895

Inverse trigonometric functions return one value, but there are two such values.

cos(a) = cos(-a) 

sin(a) = sin(PI - a)

In radians, of course.

The first thing you should do is use the sign of the values to determine the quadrant you are in. Then you can calculate the real values.

The fact that cos is positive and sinus is negative means that you are dealing with angles in the fourth quadrant; between 3PI/2 (270) and 2PI(360).

Upvotes: 2

Related Questions