Fuzzy, I didn't try your code but it looks fine. Here is my version. Polyvector is definitely fast. For large circles increase the gon value, and reduce it for small circles, for best appearance and speed.// --------------------------------- //
// Project: drawcirc-polyv
// Start: Saturday, September 14, 2013
// IDE Version: 10.283
SETSCREEN 800,600,0 //whatever
GLOBAL gon%, r%, th%, col%, cx%,cy%
here:
r=50+RND(200)
th=1+33*RND(2)
col=RGB(255*RND(1),255*RND(1),255*RND(1))
cx=RND(800) ; cy=RND(600)
IF RND(1)=1 // 50% odds.
gon=120 // steps nb, reduce for v.small circles.
ELSE
gon=3+RND(5) // n-gon.
ENDIF
drawcircpolyv(gon,cx,cy,r,th,col)
USEASBMP // ad lib
SHOWSCREEN
GOTO here
//END
FUNCTION drawcircpolyv: g%,cx%,cy%,r%,t%,c%
LOCAL sin1,sin2,cos1,cos2
STARTPOLY -1,2 // no texture, strip mode.
//(use or generate a texture with blended edges
// to skip alpha values interpolation. Donate to inkscape).
// 0___2___4__
// \ / \ / \
// 1___3___5 etc
// parallelograms are 0-1-2-3, 2-3-4-5, 4-5-6-7, etc.
FOR i% =0 TO g-1
sin1=SIN(i*360/g) ; cos1=COS(i*360/g)
sin2=SIN((i+1)*360/g) ; cos2=COS((i+1)*360/g)
POLYVECTOR cx +cos1*(r-t*0.5), cy+sin1*(r-t*0.5), 0,0,c //0, inbound
POLYVECTOR cx +cos1*(r+(t+1)*0.5), cy+sin1*(r+(t+1)*0.5), 0,0,c //1, outbound
POLYVECTOR cx +cos2*(r-t*0.5), cy+sin2*(r-t*0.5), 0,0,c //2, inbound
POLYVECTOR cx +cos2*(r+(t+1)*0.5), cy+sin2*(r+(t+1)*0.5), 0,0,c //3, outbound
// (t+1) allows thickness =1.
NEXT
ENDPOLY
ENDFUNCTION