Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get Rotation from AffineTransform

1,359 views
Skip to first unread message

Matthew Precious

unread,
Mar 27, 2010, 2:12:41 AM3/27/10
to
So according to the Java Docs, the AffineTransform class can give you
its translation, scale, and shear, but not rotation. Is there any way to
figure this out?

Thanks,
Matt

Dmitry Safonov

unread,
Mar 27, 2010, 11:58:20 AM3/27/10
to

You could keep the AffineTransform un-rotated, keep your own int theta
around somewhere, and copy the transform and apply rotate() right
before you need the rotated matrix.

Mac

unread,
Mar 27, 2010, 5:21:04 PM3/27/10
to
On Mar 27, 2:12 am, Matthew Precious

Rotation is just a combination of scaling and shearing, you could
probably use the getMatrix method, and solve the system of equations
to get the rotation value. but as Dmitry said, your better off keeping
track of it yourself, if you need it.

Mac

Matthew Precious

unread,
Mar 27, 2010, 8:24:01 PM3/27/10
to
I was trying to avoid doing that since it seems kind of crude, but I
guess that is the only way.

Thanks!

it.sp...@gmail.com

unread,
Dec 14, 2012, 4:06:02 AM12/14/12
to
Op zaterdag 27 maart 2010 07:12:41 UTC+1 schreef Matthew Precious het volgende:
What works it the following:

Math.atan2(at.getShearY(), at.getScaleY());

'at' being the AffineTransform instance
0 new messages