Hi,
Not sure if it will help you, but you may try:
Rectangle bounds = getBounds();
AffineTransform at = new AffineTransform(bounds.width/(xmax-xmin), 0,
0, -bounds.height/(ymax-ymin), bounds.getMinX(), bounds.getMaxY());
The "-" sign for the Y axis come from the fact that the y axis is downward
in pixel coordinates, while it is usualy upward in geometric coordinates.
This "-" sign must be compensate by "maxY" instead of "minY" in the
translation terms.
Martin.
----- Message d'origine -----
De : "Brad Miley" <[EMAIL PROTECTED]>
Envoyé : mercredi 4 avril 2001 02:56
Objet : <No subject given>
> I am trying to create an AffineTransform to convert real coordinates to
> pixel coordinates. So far I have:
> double xPixPerUnit = getSIze().width/(xmax-xmin);
> double yPixPerUnit = getSize().height/(ymax-ymin);
> AffineTransform at = new AffineTransform(xPixPerUnit, 0,0,yPixPerUnit, 0,
> 0);
> g2.transform(at);
>
> This seems to work for x coordinates, but not for y coordinates. Please
> help.
> Thank you.
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.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".