This could be a problem of getScaleX method or
a misinterpretation of it.

Any matrix transform can be decomposed into
rotation, scaling, and translation. When you
get scaleX, it simply returns the element at
[0][0] which is not correct. It should have
decomposed the transformation matrix into
rotation matrix, scaling matrix, and translation
matrix and return
the element [0][0] of the scaling matrix.

Mike

> I have a question on the interrelation between
> rotation and scaling.
>
> When I call g2.rotate(theta) it makes a change to
> the scaling.
>
> I find this surprising, I thought that I could do a
> rotation independent of the scaling.
>
> Can anyone explain this? I'm using JDK 1.3 on NT 4.
>
>  Thank you.
>
> ========= start code snippet
>
>         final double ONE_DEGREE = Math.PI / 180;
>
>         AffineTransform at = g2.getTransform( );
>
>         double xScale = at.getScaleX( );
>         double yScale = at.getScaleY( );
>
>         System.err.println("    setTransform( ) 1
> xScale yScale: " + xScale + "  " + yScale);
>
>         g2.rotate(ONE_DEGREE * 45);
>
>         at = g2.getTransform( );
>
>         xScale = at.getScaleX( );
>         yScale = at.getScaleY( );
>
>         System.err.println("    setTransform( ) 2
> xScale yScale: " + xScale + "  " + yScale);
>
> ========= end code snippet
>
> Here is the output:
>
>     setTransform( ) 1 xScale yScale: 1.0  1.0
>     setTransform( ) 2 xScale yScale:
> 0.7071067811865476  0.7071067811865476
>
>
>


=====
Yang-Ming

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to