views:

167

answers:

3

How can I calculate a point (X,Y) a specified distance away, on a rotated axis? I know what angle I'd like the point "moving" along (in degrees).

+7  A: 
x = cos(a) * d
y = sin(a) * d

where a is the angle and d is the distance.

If the trigonometry functions takes radians intead of degrees, you have to convert the angle by dividing by 180/pi.

Guffa
Possibly adding "+ox" and "+oy" considering (ox, oy) the origin of the rotation? Or am I wrong on this topic?
luiscubal
Sure, and a in radians not degrees or grads.
Burkhard
A: 

Do you mean the 3d formulas? They are easy as well. But we need to know what's your convention for specifying the axis.

ilya n.
+1  A: 

Convert to polar coordinates and then rotate the point through the angle you want:

x = r * cos( theta );
y = r * sin( theta );

Note: theta in radians ( deg = rad * 180 / pi )

More info on polar coordinates.

dwj