# AffineTransform rotation question

Discussion in 'Java' started by hilz, Dec 16, 2004.

1. ### hilzGuest

Hi all:
I have an AffineTransform that has a uniform scale(x scale == y scale). How
can i get the rotation portion of it, or the rotation angle "theta" ?

One suggestion was to scale it by the square root of the determinant of the
matrix, and set the translate portion to 0,0 but that does not seem to give
correct values.
Can anyone please tell me what do i need to do to get the theta ?
thanks
hilz

hilz, Dec 16, 2004

2. ### Thomas WeidenfellerGuest

hilz wrote:
> I have an AffineTransform that has a uniform scale(x scale == y scale). How
> can i get the rotation portion of it, or the rotation angle "theta" ?

Just apply the transformation to two simple points P0(0,0), P1(1,0). The
resulting P0' and P1' will allow you to determine everything you want to
know with elementary math.

/Thomas

--

Thomas Weidenfeller, Dec 17, 2004

3. ### hilzGuest

"Thomas Weidenfeller" <> wrote in message
news:cpu8em\$och\$...
> hilz wrote:
> > I have an AffineTransform that has a uniform scale(x scale == y scale).

How
> > can i get the rotation portion of it, or the rotation angle "theta" ?

>
> Just apply the transformation to two simple points P0(0,0), P1(1,0). The
> resulting P0' and P1' will allow you to determine everything you want to
> know with elementary math.
>
> /Thomas
>
> --

Thank you Thomas.
That was simple yet effective!
I am new to this area and i am experimenting with it.Your suggestion opened
my eyes to a lot of things!
thank you.
hilz

hilz, Dec 17, 2004