I think you are confusing the center of rotation with the point
at which you are drawing the rectangle. You may need to compute
the center of rotation if you want to rotate your rectangle the
way you describe it.

So if you draw a rectangle that is drawn at 100,100, that means
the upper left corner is 100,100. If you want to rotate about the
center of this rectangle, then you need to compute the center
first, which is dependent on the size of the rectangle. Just in
case you're not sure, the center will be defined by

cx = x + w/2
cy = y + h/2

where w is the width of the rectangle, and h is the height.

Try computing these and using these values for your center of
rotation as Jim described and it should work.

Mike 

> -----Original Message-----
> From: Discussion list for Java 2D API 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Tuesday, September 09, 2008 3:56 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA2D] Basic issues with affine transforms
> 
> Hi Jim,
> 
> Thanks very much for the info.
> 
> While I can understand the second tip, the first tip doesn't 
> seem to yield exactly what I am after so perhaps my 
> explanation was poor.  I want to draw a rectangle at say 
> (100, 100) with no transforms applied and then draw it again 
> with a scale factor of (2, 2) for example but have it so that 
> both rectangles share the same central point (100, 100).  
> Think of concentric circles only with rectangles.  Your 
> example (at least the way I tried it) seems to align the two 
> rectangles so that the point (100, 100) sits on one of the 
> corners of each rectangle so that they are around the point 
> but do not have it at their center.
> 
> Does this make sense?
> 
> --
> And loving it,
> 
> -Qu0ll (Rare, not extinct)
> _________________________________________________
> [EMAIL PROTECTED]
> [Replace the "SixFour" with numbers to email me] [Message 
> sent by forum member 'qu0ll' (qu0ll)]
> 
> http://forums.java.net/jive/thread.jspa?messageID=297979
> 
> ==============================================================
> =============
> 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".
> 

===========================================================================
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