Why is g2d.rotate up to 90 degrees not exactly 90 degrees? JAVA

Hi, I am trying to create a circular text. I managed to do this somehow by looping each rotated character. But I still do not understand. I do not understand the corners. Can someone please give me a good explanation? As in the following code, why is it not exactly 90 degrees? But somewhere between 100 and 120?
Graphics2D g2d = (Graphics2D)g;
    AffineTransform xform1, cxform;
    xform1 = AffineTransform.getTranslateInstance(200,200);
    g2d.setTransform(xform1);
    g2d.drawLine(0, -20, 0, 20);
    g2d.drawLine(-20, 0, 20, 0);
    xform1.rotate(Math.toDegrees(90));
    g2d.setTransform(xform1);
    g2d.drawString("a", 0, 20);

My first post. I hope I have not made any mistakes. Thanks

+3
source share
1 answer

You want to rotate 90 degrees, but it rotateaccepts radians - so your conversion is wrong. You convert 90 radians to degrees, and then pass what expects radians :) Try the following:

xform1.rotate(Math.toRadians(90));
+4
source

All Articles