Glömde bort det här med grader och radianer B)
Utgår från att Math-funktionerna räknar med radianer. En reviderad variant blir då
Kod:
function rotateX(x, y, degrees)
r = Math.sqrt(x*x + y*y);
radians = degrees * Math.PI / 180;
theta = Math.atan2(x, y) + radians;
return r * Math.cos(theta);
}
function rotateY(x, y, degrees)
r = Math.sqrt(x*x + y*y);
radians = degrees * Math.PI / 180;
theta = Math.atan2(x, y) + radians;
return r * Math.sin(theta);
}
Men som sagt, jag har inte testat alls...