> Hello,

> I need to represent an arbitrary 2x2 matrix transform:

> |A B|

> |C D|

> as the product of some series of scaling operations:

> |H 0|

> |0 V|

> and rotation operations:

> | cos sin|

> |-sin cos|

> I believe that it can be done by concatenating a rotation, a scale,

> and then another rotation, but I'm not sure.

> Does anyone have this info handy?

This is definitely possible, and here is a basic way to show how to do it

(warning: this is certainly not optimal! I suppose this kind of

transformation can be found in books on matrix).

Let M be your matrix, if it is symetric (B=C), then it is diagonalisable

in an orthogonal basis, that is, there is one rotation R, and a scaling S

such that

M = R* S R (where R* is the inverse of R), let t be the angle of R, and

Rot(t) denote the rotation with angle t,

M = Rot(-t) S Rot(t)

for any symetric M (there should be some efficient algorithms to find t

and S, I don't have any book handy here...)

Now, suppose M is not symetric, and let u be some angle, let's see

whether Rot(-u) M can be symetric:

Rot(-u) M = | a cos(u) - c sin(u) b cos(u) - d sin(u) |

| a sin(u) + c cos(u) b sin(u) - d cos(u) |

it is symetric iff:

a sin(u) + c cos(u) = b cos(u) - d sint(u)

(a+d)sin(u) = (b-c)cos(u)

that is if u = arctg( (b-c)/(a+d)) if a+b!=0

(when you implement this; as you ultimately need sin(u) and cos(u), you

won't need to explicitly calculate the arctg())

and u = PI/2 else.

Now as Rot(-u) M is symetric, there exists some scaling S and t such as

Rot(-u) M = Rot(-t) S Rot(t)

so

M = R(u-t) S Rot(t)

Regards

Francois