I developing a HTML5 Canvas App and it involves reading a xml file that describes the position of arrows, rectanges and other shapes I need to to draw on the canvas.
I think in your case you should be able to calculate this rotation position with the following system of equations:
x = R * Math.cos(angle - angle0);
y = R * Math.sin(angle - angle0);
angle = deg * Math.PI / 180;
angle0 = Math.atan(y0/x0);
R
the length of yor radius vector (len
in your example).
deg
angle in degrees you are rotating to, i.g 120°
x
and y
the coordinates of the final position your are looking for.
angle
is the actual rotation angle (in rad, not grads).
angle0
is the initial angle point was rotated to relativly to the X-axis. We need to precalculate it using Math.atan
.
Haven't tested. So give it a try. But the idea is like that same - make use of trigonometric functions.