Re: Deconstructing affine transformations into rotation, scale, skew



Ray Koopman <koopman@xxxxxx> writes in article <df0e198b-450c-4315-9781-c90aa09b53ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> dated Mon, 14 Jul 2008 00:23:56 -0700 (PDT):
theta = (1/2) arctan( 2r / (p - q) ), where M'M = [p r],
and the signs of the numerator & denominator [r q]
determine the quadrant of 2*theta. Take quadrants 3 & 4
as representing negative angles, so -PI/2 < theta <= PI/2.

That's great. I was going to use a numerical method (Newton's) to find
where the derivative was 0, but closed form is better.

The square roots of of f(theta) and f(theta+PI/2) would be the
diagonal of D. Then a little matrix inversion to calculate V'.

No, you just solved for V = [ cos(theta) -sin(theta) ]
[ sin(theta) cos(theta) ].

Of course -- we want the rotational transformation for -theta, not theta.

To get U, normalize each column of MV = UD; i.e., divide
by the appropriate d, which is the length of the column.

Since the Java API has an invert method built right in, I used
U = M*invert(D*V')

Thanks again for your help!

--Spud Demon
.