Robin Rodricks
Robin Rodricks

Reputation: 114126

How to calculate a point on a rotated axis?

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).

Upvotes: 0

Views: 2400

Answers (3)

dwj
dwj

Reputation: 3483

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.

Upvotes: 1

ilya n.
ilya n.

Reputation: 18826

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

Upvotes: 0

Guffa
Guffa

Reputation: 700720

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.

Upvotes: 7

Related Questions