I am porting some of the Slick Graphics class to work with AWT, but I've run into a problem. Slick, being run on OpenGL, draws arcs clockwise. AWT defines them as being drawn counter-clockwise, like in math. I'm wondering how I can draw Slick's arc counter-clockwise, so that it matches AWT.
An image of what I'd expect:
An image of what I get:
This is the function to draw an arc in Slick2D:
public void drawArc(float x1,
float y1,
float width,
float height,
float start,
float end)
Since it appears that Slick draws these arcs clock-wise (0 - 360 degrees) then you can do some simple arithmetic to get the effect that you wish.
A and B are your original angles that you wish to draw the arc in between like 0 and 90 degrees. drawArc(0,0,1,1,A,B)
will render an arc from A to B, but we want an arc from C to D which is the same arc as A to B but counter-clock wise. Since you already know the values of A and B (like 0 and 90) you can get the values for C and D with the following:
C = 360 - B
D = 360 - A
So now we can just use drawArc(0,0,1,1,C,D)
.
Test it with values:
A = 0
B = 90
C = 360 - 90 = 270
D = 360 - 0 = 360
This will plot an arc from 270 to 360 which is the same as an arc from 0 to 90 counter-clock wise.