i managed to make ur codes work in my applet :)

check the post above :)

BTW:

what does 2 lines do ? i completely cannot follow

"

c=cta2-(i-1)*dc; // c = end of angle segment - (i-1)*a small segment ?

if(c<-pi)c+=2*pi; // if c less than - Math.PI then c add one until 2*PI ?

"

[/quote]

The purpose of the above code is to make sure angle c would not be less than -pi;

If it is less than -pi, add the angle with 2*pi.

I think the purpose is to have correct calculated components.