> I'm translating and rotating a polygon with graphics2D (g2) and
> everything works fine :
[quoted text clipped - 3 lines]
> g2.drawPolygon(pol);
> //reinit
It is better to keep a copy of the original, instead of trying to
reverse your operations, ...
> g2.translate(-x, -y);
> g2.rotate(-r);
... because this adds rounding errors.
[...]
> So, if there was a possibility to get the new coordinates of my polygon
> with the first solution (everything done with graphics2D),
There are no new polygon user space coordinates, since you have in no
way translated the polygon. You have changed the origin and rotation of
the device space coordinate system in which the polygon is drawn. Within
that coordinate system the polygon user space coordinates are absolutely
the same as before.
So what is it what you really want?
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Chantal - 24 Jan 2006 14:52 GMT
Hello Thomas,
Thanks you for your answer.
How to get original values ?
What I wanted was to try to get the coordonnates of the rotated polygon
but if it's only the device space system coordinates which is changed,
I don't have certainly the possibility to get it. I'll try another way.
Thanks again Thomas, :o)
Chantal
Chantal - 24 Jan 2006 14:57 GMT
Re,
I get it I think : g2.getTransform().getTranslateX();
etc...
Thanks again
>But I would like to know if it's possible to get the new coordinates of
>the polygon, I mean after the rotation and translation are done.
See http://mindprod.com/jgloss/affinetransform.html#MANUAL
It shows you how to transform an individual point.
Unfortunately that method requires you do the matrix multiply twice,
once for the polygon for drawing and once for discovering where the
transform put the points.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.