gfx.arc isn't using the same reference angle as Lua's trig functions. The lines in the image below were drawn using the same angle as the arc's endpoints. As you can see, the arc is 90 degrees away from where it should be.
It's not a difficult thing to fix - just add 0.5 to the rad values when you draw an arc - but it's a prime candidate for the Nitpick forum. If we'd rather not fix it due to the havoc it would wreak on existing scripts, at minimum I'd like to see a note added to the API documentation so nobody else has to waste an hour figuring out why their code was all messed up like I just did.
Cheers.
Code:
local name, w, h = "", 258, 258
local x, y = reaper.GetMousePosition()
x, y = x - (w / 2) - 8, y - (h / 2) - 30
local ox, oy = w / 2, h / 2
local angle_a = -0.25 * math.pi
local angle_b = 0.25 * math.pi
local r = 96
function Main()
local quit = gfx.getchar()
if quit == -1 or quit == 27 then return 0 end
gfx.set(0.2, 1, 0.2, 1)
local ax = ox + r * math.cos(angle_a)
local ay = oy + r * math.sin(angle_a)
gfx.line(ox, oy, ax, ay)
local bx = ox + r * math.cos(angle_b)
local by = oy + r * math.sin(angle_b)
gfx.line(ox, oy, bx, by)
gfx.set(1, 0.2, 0.2, 1)
gfx.arc(ox, oy, r, angle_a, angle_b, 1)
reaper.defer(Main)
gfx.update()
end
gfx.init(name, w, h, 0, x, y)
Main()