Math


Most of the mathematical functions are available in the Math object. The list of available methods is determined by the specification ECMAScript Math Object

function circle(){
    x0 = mouse.getX();
    y0 = mouse.getY();
    r=100;
    dL = 4;
    n=1;
    system.println('x0:'+x0+', y0:'+y0+", r:"+r+", dL:"+dL+", n:"+n);
    for(L=0;L<=360*n;L+=dL){
        dx = Math.cos(radians(L))*r;
        dy = Math.sin(radians(L))*r;
        x1 = x0+dx;
        y1 = y0+dy;
        mouse.moveTo(x1,y1)
    }
    mouse.moveTo(x0,y0);
}
	
function radians(degrees){
    return degrees * Math.PI / 180;
}

circle();

In order to use the standard Java class, redefine the Math object will add a line at the beginning of the script.

 var Math = Java.type('java.lang.Math');

ECMAScript Math Object, Math